|
|
@ -120,18 +120,21 @@ static char *config_GetAppDir (void) |
|
|
{ |
|
|
{ |
|
|
/* if portable directory exists, use it */ |
|
|
/* if portable directory exists, use it */ |
|
|
WCHAR path[MAX_PATH]; |
|
|
WCHAR path[MAX_PATH]; |
|
|
if (GetModuleFileName (NULL, path, MAX_PATH)) |
|
|
if (GetModuleFileNameW (NULL, path, MAX_PATH)) |
|
|
{ |
|
|
{ |
|
|
WCHAR *lastDir = wcsrchr (path, TEXT('\\')); |
|
|
WCHAR *lastDir = wcsrchr (path, L'\\'); |
|
|
if (lastDir) |
|
|
if (lastDir) |
|
|
{ |
|
|
{ |
|
|
wcscpy (lastDir + 1, TEXT("portable")); |
|
|
*lastDir = L'\0'; |
|
|
DWORD attrib = GetFileAttributes (path); |
|
|
if (wcscat_s(path, ARRAY_SIZE(path), TEXT("\\portable")) == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
DWORD attrib = GetFileAttributesW (path); |
|
|
if (attrib != INVALID_FILE_ATTRIBUTES && |
|
|
if (attrib != INVALID_FILE_ATTRIBUTES && |
|
|
(attrib & FILE_ATTRIBUTE_DIRECTORY)) |
|
|
(attrib & FILE_ATTRIBUTE_DIRECTORY)) |
|
|
return FromWide (path); |
|
|
return FromWide (path); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
char *psz_dir; |
|
|
char *psz_dir; |
|
|
char *psz_parent = config_GetKnownFolder (FOLDERID_RoamingAppData); |
|
|
char *psz_parent = config_GetKnownFolder (FOLDERID_RoamingAppData); |
|
|
|