LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1997--2019 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2019 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return string (cwd.data ()); | 94 return string (cwd.data ()); |
95 } | 95 } |
96 | 96 |
97 /* Join components to full file_name. */ | 97 /* Join components to full file_name. */ |
98 string | 98 string |
99 File_name::dir_part () const | 99 File_name::dir_part () const |
100 { | 100 { |
101 string s; | 101 string s; |
102 | 102 |
103 if (!root_.empty ()) | 103 if (!root_.empty ()) |
104 s = root_ + ::to_string (ROOTSEP); | 104 s = root_ + ROOTSEP; |
105 | 105 |
106 // handle special case of `/' | 106 // handle special case of `/' |
107 if (dir_.empty () && is_absolute_) | 107 if (dir_.empty () && is_absolute_) |
108 s += ::to_string (DIRSEP); | 108 s += DIRSEP; |
109 | 109 |
110 if (!dir_.empty ()) | 110 if (!dir_.empty ()) |
111 s += dir_; | 111 s += dir_; |
112 | 112 |
113 return s; | 113 return s; |
114 } | 114 } |
115 | 115 |
116 string | 116 string |
117 File_name::file_part () const | 117 File_name::file_part () const |
118 { | 118 { |
119 string s = base_; | 119 string s = base_; |
120 | 120 |
121 if (!ext_.empty ()) | 121 if (!ext_.empty ()) |
122 s += ::to_string (EXTSEP) + ext_; | 122 s += EXTSEP + ext_; |
123 | 123 |
124 return s; | 124 return s; |
125 } | 125 } |
126 | 126 |
127 string | 127 string |
128 File_name::to_string () const | 128 File_name::to_string () const |
129 { | 129 { |
130 string d = dir_part (); | 130 string d = dir_part (); |
131 string f = file_part (); | 131 string f = file_part (); |
132 | 132 |
133 if (!f.empty () | 133 if (!f.empty () |
134 && !dir_.empty ()) | 134 && !dir_.empty ()) |
135 d += ::to_string (DIRSEP); | 135 d += DIRSEP; |
136 | 136 |
137 return d + f; | 137 return d + f; |
138 } | 138 } |
139 | 139 |
140 File_name::File_name (string file_name) | 140 File_name::File_name (string file_name) |
141 { | 141 { |
142 #ifdef __MINGW32__ | 142 #ifdef __MINGW32__ |
143 file_name = slashify (file_name); | 143 file_name = slashify (file_name); |
144 #endif | 144 #endif |
145 | 145 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 new_components.push_back ("."); | 212 new_components.push_back ("."); |
213 } | 213 } |
214 } | 214 } |
215 else | 215 else |
216 new_components.push_back (components[i]); | 216 new_components.push_back (components[i]); |
217 } | 217 } |
218 | 218 |
219 c.dir_ = string_join (new_components, "/"); | 219 c.dir_ = string_join (new_components, "/"); |
220 return c; | 220 return c; |
221 } | 221 } |
LEFT | RIGHT |