From e9f4bf173265401c6efb04704e4d867a5258cc7d Mon Sep 17 00:00:00 2001 From: Uladzimir Karpenka Date: Tue, 2 Jun 2026 17:03:14 +0300 Subject: [PATCH] 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 --- PlatformUtils.pas | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PlatformUtils.pas b/PlatformUtils.pas index 26577d9..dcfebee 100644 --- a/PlatformUtils.pas +++ b/PlatformUtils.pas @@ -68,7 +68,16 @@ end; function GetAppCfgDir: string; 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)); +{$ENDIF} if not DirectoryExists(Result) then ForceDirectories(Result); end;