Skip to content

Commit 637593e

Browse files
Add: flatpak program uses different data folder
[skip CI]
1 parent f42631c commit 637593e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

source/code/main.pas

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,21 @@ procedure TFormTrackerModify.FormCreate(Sender: TObject);
236236
end;
237237

238238
{$IFDEF LINUX}
239-
// if a ubuntu snap program then save it to other place
239+
// If it is a Ubuntu snap program, save it a special folder
240240
FFolderForTrackerListLoadAndSave := GetEnvironmentVariable('SNAP_USER_COMMON');
241+
// If it is a flatpak program, save it in a special folder
242+
if GetEnvironmentVariable('container') = 'flatpak' then
243+
begin
244+
FFolderForTrackerListLoadAndSave := GetEnvironmentVariable('XDG_DATA_HOME');
245+
end;
241246
if FFolderForTrackerListLoadAndSave = '' then
242247
begin
243-
// NOT a snap program
248+
// No container detected. Save in the same place as the application file
244249
FFolderForTrackerListLoadAndSave := ExtractFilePath(Application.ExeName);
245250
end
246251
else
247252
begin
248-
// A snap program
253+
// Program run in a container. Must load file from a dedicated folder.
249254
FFolderForTrackerListLoadAndSave := AppendPathDelim(FFolderForTrackerListLoadAndSave);
250255
end;
251256
{$ELSE}

0 commit comments

Comments
 (0)