From ef861421e2bc467e01eafc3d13864d931cf5014d Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sat, 28 Aug 2021 03:20:04 -0700 Subject: [PATCH] stb.h: stb_splitpath correctly handles relative paths with explicit drive specifiers --- deprecated/stb.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deprecated/stb.h b/deprecated/stb.h index 80fa202..1633c3b 100644 --- a/deprecated/stb.h +++ b/deprecated/stb.h @@ -2423,6 +2423,12 @@ static char *stb__splitpath_raw(char *buffer, char *path, int flag) char *s = stb_strrchr2(path, '/', '\\'); char *t = strrchr(path, '.'); if (s && t && t < s) t = NULL; + + if (!s) { + // check for drive + if (isalpha(path[0]) && path[1] == ':') + s = &path[1]; + } if (s) ++s; if (flag == STB_EXT_NO_PERIOD)