mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-07 16:48:15 +08:00
adapt file path checks
This commit is contained in:
parent
d1aa57ac5d
commit
19dd580b3b
1 changed files with 50 additions and 49 deletions
|
@ -85,10 +85,11 @@ int searchHomeFilePath(char **foundpath, const char *subdir, const char *filenam
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct _stat st;
|
struct _stat st;
|
||||||
// Mingw _stat fails if path ends with /, so let's use a stripped path
|
// Mingw _stat fails if path ends with /, so let's use a stripped path
|
||||||
if (path[strlen(path) - 1] == '/') {
|
if (str_endswith(path, PATHSEP))
|
||||||
path[strlen(path) - 1] = '\0';
|
|
||||||
|
memset(path + (strlen(path) - strlen(PATHSEP)), 0x00, strlen(PATHSEP));
|
||||||
result = _stat(path, &st);
|
result = _stat(path, &st);
|
||||||
path[strlen(path)] = '/';
|
strncat(path, PATHSEP, strlen(PATHSEP));
|
||||||
} else {
|
} else {
|
||||||
result = _stat(path, &st);
|
result = _stat(path, &st);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue