summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-12 22:35:09 -0500
committerpommicket <pommicket@gmail.com>2023-01-12 22:35:29 -0500
commit1b318330c94a19b922d05b6fac19f6a4a59d248a (patch)
tree60ad90ff82c182435abd37aac6f791b97fd42c98 /util.c
parent024fd444d673be63ac23fc83481a8fe624127cbf (diff)
[2.0] minor windows path-related fixes, windows installer version
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/util.c b/util.c
index e40f258..a0e91aa 100644
--- a/util.c
+++ b/util.c
@@ -338,9 +338,10 @@ void qsort_with_context(void *base, size_t nmemb, size_t size,
#endif
const char *path_filename(const char *path) {
- const char *last_path_sep = strrchr(path, PATH_SEPARATOR);
- if (last_path_sep)
- return last_path_sep + 1;
+ for (int i = (int)strlen(path) - 1; i >= 0; --i) {
+ if (strchr(ALL_PATH_SEPARATORS, path[i]))
+ return &path[i+1];
+ }
// (a relative path with no path separators)
return path;
}