File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
// LAF Base Library
2
- // Copyright (c) 2021-2024 Igara Studio S.A.
2
+ // Copyright (c) 2021-2025 Igara Studio S.A.
3
3
// Copyright (c) 2001-2018 David Capello
4
4
//
5
5
// This file is released under the terms of the MIT license.
@@ -35,6 +35,17 @@ const std::string::value_type* path_separators = "\\/";
35
35
const std::string::value_type* path_separators = " /" ;
36
36
#endif
37
37
38
+ bool is_absolute_path (const std::string& path)
39
+ {
40
+ #ifdef LAF_WINDOWS
41
+ return (path.size () > 2 && path[1 ] == ' :' && path[2 ] == path_separator) ||
42
+ // Absolute network path
43
+ (path.size () > 1 && path[0 ] == path_separator && path[1 ] == path_separator);
44
+ #else
45
+ return !path.empty () && path[0 ] == path_separator;
46
+ #endif
47
+ }
48
+
38
49
void make_all_directories (const std::string& path)
39
50
{
40
51
std::vector<std::string> parts;
@@ -194,7 +205,8 @@ std::string get_relative_path(const std::string& filename, const std::string& ba
194
205
auto itFrom = baseDirs.begin ();
195
206
auto itTo = toParts.begin ();
196
207
197
- while (itFrom != baseDirs.end () && itTo != toParts.end () && *itFrom == *itTo) {
208
+ while (itFrom != baseDirs.end () && itTo != toParts.end () &&
209
+ base::string_to_lower (*itFrom) == base::string_to_lower ((*itTo))) {
198
210
++itFrom;
199
211
++itTo;
200
212
}
Original file line number Diff line number Diff line change 1
1
// LAF Base Library
2
- // Copyright (c) 2020-2024 Igara Studio S.A.
2
+ // Copyright (c) 2020-2025 Igara Studio S.A.
3
3
// Copyright (c) 2001-2018 David Capello
4
4
//
5
5
// This file is released under the terms of the MIT license.
@@ -28,6 +28,7 @@ extern const std::string::value_type* path_separators;
28
28
29
29
bool is_file (const std::string& path);
30
30
bool is_directory (const std::string& path);
31
+ bool is_absolute_path (const std::string& path);
31
32
32
33
size_t file_size (const std::string& path);
33
34
You can’t perform that action at this time.
0 commit comments