mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 04:04:39 +02:00
fix for current working directory, relative path instead of absolute, suggestion from SpamapS
This commit is contained in:
@@ -822,9 +822,17 @@ static INLINE void ChangeDirBack(int x)
|
|||||||
static INLINE int CurrentDir(const char* str)
|
static INLINE int CurrentDir(const char* str)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
char* baseName;
|
||||||
|
|
||||||
GetCurrentDirectoryA(sizeof(path), path);
|
GetCurrentDirectoryA(sizeof(path), path);
|
||||||
if (strstr(path, str))
|
|
||||||
|
baseName = strrchr(path, '\\');
|
||||||
|
if (baseName)
|
||||||
|
baseName++;
|
||||||
|
else
|
||||||
|
baseName = path;
|
||||||
|
|
||||||
|
if (strstr(baseName, str))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -860,12 +868,20 @@ static INLINE void ChangeDirBack(int x)
|
|||||||
static INLINE int CurrentDir(const char* str)
|
static INLINE int CurrentDir(const char* str)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
char* baseName;
|
||||||
|
|
||||||
if (getcwd(path, sizeof(path)) == NULL) {
|
if (getcwd(path, sizeof(path)) == NULL) {
|
||||||
printf("no current dir?\n");
|
printf("no current dir?\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strstr(path, str))
|
|
||||||
|
baseName = strrchr(path, '/');
|
||||||
|
if (baseName)
|
||||||
|
baseName++;
|
||||||
|
else
|
||||||
|
baseName = path;
|
||||||
|
|
||||||
|
if (strstr(baseName, str))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user