]> git.lyx.org Git - lyx.git/blob - src/support/os.h
make "make distcheck" work
[lyx.git] / src / support / os.h
1 // -*- C++ -*-
2 /**
3  * \file os.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Ruurd A. Reitsma
8  *
9  * Full author contact details are available in file CREDITS.
10  *
11  * wrap OS-specific stuff
12  */
13
14 #ifndef OS_H
15 #define OS_H
16
17 #include <string>
18
19
20 namespace lyx {
21 namespace support {
22 namespace os {
23
24 enum shell_type {
25         UNIX,   // Do we have to distinguish sh and csh?
26         CMD_EXE
27 };
28
29 /// Do some work just once.
30 void init(int argc, char * argv[]);
31
32 /// Returns the name of the NULL device (/dev/null, null).
33 std::string const & nulldev();
34
35 /// Returns "/" on *nix, "C:/", etc on Windows.
36 std::string current_root();
37
38 ///
39 shell_type shell();
40
41 /// Extract the path common to both @c p1 and @c p2. DBCS aware!
42 std::string::size_type common_path(std::string const & p1, std::string const & p2);
43
44 /// Converts a unix style path to host OS style.
45 std::string external_path(std::string const & p);
46
47 /// Converts a host OS style path to unix style.
48 std::string internal_path(std::string const & p);
49
50 /// Is the path absolute?
51 bool is_absolute_path(std::string const & p);
52
53 /** Returns a string suitable to be passed to popen when
54  *  reading a file.
55  */
56 char const * popen_read_mode();
57
58 /** The character used to separate paths returned by the
59  *  PATH environment variable.
60  */
61 char path_separator();
62
63 /** If @c use_cygwin_paths is true, LyX will output cygwin style paths
64  *  rather than native Win32 ones. Obviously, this option is used only
65  *  under Cygwin.
66  */
67 void cygwin_path_fix(bool use_cygwin_paths);
68
69 } // namespace os
70 } // namespace support
71 } // namespace lyx
72
73 #endif