diff options
author | pommicket <pommicket@gmail.com> | 2023-01-12 23:26:31 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-12 23:26:31 -0500 |
commit | 75dad99bb72d81a69e6bddee0279835683e6c27b (patch) | |
tree | d2eb7bd36f6087563a3e0c9b2656064171f87791 /util.c | |
parent | ba0aed7ab927a6d7c96d1191896f8cfdfae563de (diff) |
[2.0] fix path_full on windows
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -384,11 +384,15 @@ void path_full(const char *dir, const char *relpath, char *abspath, size_t abspa } else if (component_len == 2 && relpath[0] == '.' && relpath[1] == '.') { // .. char *lastsep = strrchr(abspath, PATH_SEPARATOR); - assert(lastsep); - if (lastsep == abspath) - lastsep[1] = '\0'; - else - lastsep[0] = '\0'; + if (lastsep) { + if (lastsep == abspath) + lastsep[1] = '\0'; // e.g. /abc + else + lastsep[0] = '\0'; + } else { + // e.g. if abspath is currently C: + // (do nothing) + } } else { if (len == 0 || abspath[len - 1] != PATH_SEPARATOR) str_cat(abspath, abspath_size, PATH_SEPARATOR_STR); |