@@ -162,7 +162,7 @@ TFormTrackerModify = class(TForm)
162162 FFilePresentBanByUserList// There is a file 'remove_trackers.txt' detected
163163 : boolean;
164164
165-
165+ FFolderForTrackerListLoadAndSave: string;
166166 FLogFile, FTrackerFile: TextFile;
167167 FProcessTimeStart, FProcessTimeTotal: TDateTime;
168168 FControlerGridTorrentData: TControlerGridTorrentData;
@@ -234,6 +234,24 @@ procedure TFormTrackerModify.FormCreate(Sender: TObject);
234234 Exit;
235235 end ;
236236
237+ { $IFDEF LINUX}
238+ // if a ubuntu snap program then save it to other place
239+ FFolderForTrackerListLoadAndSave := GetEnvironmentVariable(' SNAP_USER_COMMON' );
240+ if FFolderForTrackerListLoadAndSave = ' ' then
241+ begin
242+ // NOT a snap program
243+ FFolderForTrackerListLoadAndSave := ExtractFilePath(Application.ExeName);
244+ end
245+ else
246+ begin
247+ // A snap program
248+ FFolderForTrackerListLoadAndSave := AppendPathDelim(FFolderForTrackerListLoadAndSave);
249+ end ;
250+ { $ELSE}
251+ // Save at the same place as the application file
252+ FFolderForTrackerListLoadAndSave := ExtractFilePath(Application.ExeName);
253+ { $ENDIF}
254+
237255 // Create controler for StringGridTorrentData
238256 FControlerGridTorrentData := TControlerGridTorrentData.Create(StringGridTorrentData);
239257
@@ -859,8 +877,7 @@ procedure TFormTrackerModify.SaveTrackerFinalListToFile;
859877 TrackerStr: UTF8String;
860878begin
861879 // Create the tracker text file. The old one will be overwritten
862- AssignFile(FTrackerFile, ExtractFilePath(Application.ExeName) +
863- FILE_NAME_EXPORT_TRACKERS);
880+ AssignFile(FTrackerFile, FFolderForTrackerListLoadAndSave + FILE_NAME_EXPORT_TRACKERS);
864881 ReWrite(FTrackerFile);
865882 for TrackerStr in FTrackerList.TrackerFinalList do
866883 begin
@@ -898,7 +915,7 @@ procedure TFormTrackerModify.ConsoleModeOrDragAndDropStartupMode;
898915 if FConsoleMode then
899916 begin
900917 // Create the log file. The old one will be overwritten
901- AssignFile(FLogFile, ExtractFilePath(Application.ExeName) + FILE_NAME_CONSOLE_LOG);
918+ AssignFile(FLogFile, FFolderForTrackerListLoadAndSave + FILE_NAME_CONSOLE_LOG);
902919 ReWrite(FLogFile);
903920 end ;
904921
@@ -1219,7 +1236,7 @@ procedure TFormTrackerModify.LoadTrackersTextFileAddTrackers(
12191236 // Called at the start of the program. Load a trackers list from file
12201237
12211238 // if no file is found the use the default tracker list.
1222- if not ReadAddTrackerFileFromUser(ExtractFilePath(Application.ExeName) +
1239+ if not ReadAddTrackerFileFromUser(FFolderForTrackerListLoadAndSave +
12231240 FILE_NAME_ADD_TRACKERS) then
12241241 begin
12251242 MemoNewTrackers.Lines.BeginUpdate;
@@ -1241,7 +1258,7 @@ procedure TFormTrackerModify.LoadTrackersTextFileRemoveTrackers;
12411258var
12421259 filename: UTF8String;
12431260begin
1244- filename := ExtractFilePath(Application.ExeName) + FILE_NAME_REMOVE_TRACKERS;
1261+ filename := FFolderForTrackerListLoadAndSave + FILE_NAME_REMOVE_TRACKERS;
12451262 try
12461263 FFilePresentBanByUserList := FileExistsUTF8(fileName);
12471264 if FFilePresentBanByUserList then
0 commit comments