]> git.lyx.org Git - lyx.git/blob - src/support/os_unix.C
* filetools.[Ch]: Make functions that start with a capital
[lyx.git] / src / support / os_unix.C
1 /**
2  * \file os_unix.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Ruurd A. Reitsma
7  *
8  * Full author contact details are available in file CREDITS.
9  *
10  * Various OS specific functions
11  */
12
13 #include <config.h>
14
15 #include "support/os.h"
16
17 using std::string;
18
19
20 namespace lyx {
21 namespace support {
22 namespace os {
23
24 void init(int, char *[])
25 {}
26
27
28 string current_root()
29 {
30         return "/";
31 }
32
33
34 string::size_type common_path(string const & p1, string const & p2)
35 {
36         string::size_type i = 0;
37         string::size_type p1_len = p1.length();
38         string::size_type p2_len = p2.length();
39         while (i < p1_len && i < p2_len && p1[i] == p2[i])
40                 ++i;
41         if ((i < p1_len && i < p2_len)
42             || (i < p1_len && p1[i] != '/' && i == p2_len)
43             || (i < p2_len && p2[i] != '/' && i == p1_len))
44         {
45                 if (i)
46                         --i;     // here was the last match
47                 while (i && p1[i] != '/')
48                         --i;
49         }
50         return i;
51 }
52
53
54 string external_path(string const & p)
55 {
56         return p;
57 }
58
59
60 string internal_path(string const & p)
61 {
62         return p;
63 }
64
65
66 string external_path_list(string const & p)
67 {
68         return p;
69 }
70
71
72 string internal_path_list(string const & p)
73 {
74         return p;
75 }
76
77
78 string latex_path(string const & p)
79 {
80         return p;
81 }
82
83
84 bool is_absolute_path(string const & p)
85 {
86         return !p.empty() && p[0] == '/';
87 }
88
89
90 char const * popen_read_mode()
91 {
92         return "r";
93 }
94
95
96 string const & nulldev()
97 {
98         static string const nulldev_ = "/dev/null";
99         return nulldev_;
100 }
101
102
103 shell_type shell()
104 {
105         return UNIX;
106 }
107
108
109 char path_separator()
110 {
111         return ':';
112 }
113
114
115 void cygwin_path_fix(bool)
116 {}
117
118 } // namespace os
119 } // namespace support
120 } // namespace lyx