adapt file path checks

This commit is contained in:
iceman1001 2023-01-08 21:52:30 +01:00
parent d1aa57ac5d
commit 19dd580b3b

View file

@ -85,10 +85,11 @@ int searchHomeFilePath(char **foundpath, const char *subdir, const char *filenam
#ifdef _WIN32
struct _stat st;
// Mingw _stat fails if path ends with /, so let's use a stripped path
if (path[strlen(path) - 1] == '/') {
path[strlen(path) - 1] = '\0';
if (str_endswith(path, PATHSEP))
memset(path + (strlen(path) - strlen(PATHSEP)), 0x00, strlen(PATHSEP));
result = _stat(path, &st);
path[strlen(path)] = '/';
strncat(path, PATHSEP, strlen(PATHSEP));
} else {
result = _stat(path, &st);
}