mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
fix Windows config dir: use %APPDATA% env var directly
FPC's GetAppConfigDir on Windows falls back to the exe directory if the shell API call fails, which breaks installs in Program Files. Read %APPDATA% from the environment variable instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -68,7 +68,16 @@ end;
|
|||||||
|
|
||||||
function GetAppCfgDir: string;
|
function GetAppCfgDir: string;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
Result := GetEnvironmentVariable('APPDATA');
|
||||||
|
if Result = '' then
|
||||||
|
Result := GetEnvironmentVariable('LOCALAPPDATA');
|
||||||
|
if Result = '' then
|
||||||
|
Result := ExtractFilePath(ParamStr(0));
|
||||||
|
Result := IncludeTrailingPathDelimiter(Result) + 'ewsdr' + PathDelim;
|
||||||
|
{$ELSE}
|
||||||
Result := IncludeTrailingPathDelimiter(GetAppConfigDir(False));
|
Result := IncludeTrailingPathDelimiter(GetAppConfigDir(False));
|
||||||
|
{$ENDIF}
|
||||||
if not DirectoryExists(Result) then
|
if not DirectoryExists(Result) then
|
||||||
ForceDirectories(Result);
|
ForceDirectories(Result);
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user