diff options
| author | gingerBill <bill@gingerbill.org> | 2022-09-21 11:31:52 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-09-21 11:31:52 +0100 |
| commit | 3ff56e44050afdc1794ab34864682f76723682f9 (patch) | |
| tree | 3f1134e63e60dd0ec897c7eee7ab763b00fa2ffc /src/build_settings.cpp | |
| parent | eb7a9c55b03efe0245eb4ccd1abd552edc99224d (diff) | |
Correct `get_fullpath_relative` to remove all trailing path separators (`/` and `\`)
Diffstat (limited to 'src/build_settings.cpp')
| -rw-r--r-- | src/build_settings.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index fc5a9d19f..f640bcced 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -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; 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); res = string_trim_whitespace(res); |