]> git.lyx.org Git - lyx.git/blob - src/support/os_unix.C
make "make distcheck" work
[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 bool is_absolute_path(string const & p)
67 {
68         return !p.empty() && p[0] == '/';
69 }
70
71
72 char const * popen_read_mode()
73 {
74         return "r";
75 }
76
77
78 string const & nulldev()
79 {
80         static string const nulldev_ = "/dev/null";
81         return nulldev_;
82 }
83
84
85 shell_type shell()
86 {
87         return UNIX;
88 }
89
90
91 char path_separator()
92 {
93         return ':';
94 }
95
96
97 void cygwin_path_fix(bool)
98 {}
99
100 } // namespace os
101 } // namespace support
102 } // namespace lyx