mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Correct get_fullpath_relative to remove all trailing path separators (/ and \)
This commit is contained in:
@@ -986,6 +986,15 @@ String get_fullpath_relative(gbAllocator a, String base_dir, String path) {
|
|||||||
gb_memmove(str+i, path.text, path.len); i += path.len;
|
gb_memmove(str+i, path.text, path.len); i += path.len;
|
||||||
str[i] = 0;
|
str[i] = 0;
|
||||||
|
|
||||||
|
// IMPORTANT NOTE(bill): Remove trailing path separators
|
||||||
|
// this is required to make sure there is a conventional
|
||||||
|
// notation for the path
|
||||||
|
for (/**/; i > 0; i--) {
|
||||||
|
u8 c = str[i-1];
|
||||||
|
if (c != '/' && c != '\\') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String res = make_string(str, i);
|
String res = make_string(str, i);
|
||||||
res = string_trim_whitespace(res);
|
res = string_trim_whitespace(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user