]> git.lyx.org Git - lyx.git/blob - src/support/os.h
fix typo that put too many include paths for most people
[lyx.git] / src / support / os.h
1 // os.h copyright "Ruurd A. Reitsma" <R.A.Reitsma@wbmt.tudelft.nl>
2
3 #ifndef OS_H
4 #define OS_H
5
6 #ifdef __GNUG__
7 #pragma interface
8 #endif
9
10 #include "LString.h"
11
12 /// Do we need a base class for this?
13 class os {
14 public:
15         //
16         enum shell_type {
17                 UNIX,   // Do we have to distinguish sh and csh?
18                 CMD_EXE
19         };
20
21         //
22         static void init(int * argc, char ** argv[]);
23
24         //
25         static string binpath() {return binpath_;}
26
27         //
28         static string binname() {return binname_;}
29
30         // system_tempdir actually doesn't belong here.
31         // I put it here only to avoid a global variable.
32         static void setTmpDir(string p) {tmpdir_ = p;}
33
34         //
35         static string getTmpDir() {return tmpdir_;}
36
37         //
38         static string current_root();
39
40         //
41         static os::shell_type shell() {return _shell;}
42
43         // DBCS aware!
44         static string::size_type common_path(string const &p1,
45                                              string const &p2);
46
47         // no-op on UNIX, '\\'->'/' on OS/2 and Win32, ':'->'/' on MacOS, etc.
48         static string slashify_path(string p);
49         // converts a host OS path to unix style
50         static string external_path(string const &p);
51         // converts a unix path to host OS style
52         static string internal_path(string const &p);
53         // is path absolute?
54         static bool is_absolute_path(string const & p);
55         // returns a string suitable to be passed to fopen/popen when
56         // reading a file
57         static char const * read_mode();
58         //
59         static void warn(string mesg);
60 private:
61         static string binpath_;
62         static string binname_;
63         static string tmpdir_;
64         static os::shell_type _shell;
65         // Used only on OS/2 to determine file system encoding.
66         static unsigned long cp_;
67
68         // Never initialize static variables in the header!
69         // Anyway I bet this class will never be constructed.
70         os() {};
71
72         // Ignore warning!
73         ~os() {};
74
75 };
76
77 #endif