Skip to content

Commit d7dc59b

Browse files
Show 'warning text' if read-only files are detected.
1 parent 3de1c9d commit d7dc59b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

source/code/main.pas

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ procedure TFormTrackerModify.UpdateTorrent;
473473
var
474474
Reply, BoxStyle, i, CountTrackers: integer;
475475
PopUpMenuStr: string;
476+
SomeFilesAreReadOnly: Boolean;
476477

477478
begin
478479
//Update all the torrent files.
@@ -547,15 +548,26 @@ procedure TFormTrackerModify.UpdateTorrent;
547548
ShowHourGlassCursor(True);
548549
end;
549550

551+
//initial value is false, will be set to true if read only files are found
552+
SomeFilesAreReadOnly := False;
553+
550554
//process all the files one by one.
551555
//FTorrentFileNameList is not sorted it is still in sync with CheckListBoxPublicPrivateTorrent
552556
for i := 0 to FTorrentFileNameList.Count - 1 do
553557
begin //read the torrent file in FDecodePresentTorrent and modify it.
554558

559+
//check for read only files. It can not be updated by tracker editor
560+
if (FileGetAttr(FTorrentFileNameList[i]) and faReadOnly) <> 0 then
561+
begin
562+
SomeFilesAreReadOnly := True;
563+
Continue;
564+
end;
565+
555566
//read one torrent file. If error then skip it. (continue)
556567
if not FDecodePresentTorrent.DecodeTorrent(FTorrentFileNameList[i]) then
568+
begin
557569
Continue;
558-
570+
end;
559571

560572
//tloSort it is already process. But if not tloSort then process it.
561573
if FTrackerListOrderForUpdatedTorrent <> tloSort then
@@ -652,6 +664,13 @@ procedure TFormTrackerModify.UpdateTorrent;
652664
begin
653665
Assert(True, 'case else: Should never been called. UpdateTorrent');
654666
end;
667+
668+
end;//case
669+
670+
if SomeFilesAreReadOnly then
671+
begin
672+
//add warning if read only files are detected.
673+
PopUpMenuStr := PopUpMenuStr + ' Warning: Some torrent files are not updated bacause they are READ-ONLY files.';
655674
end;
656675

657676
//Show the MessageBox

0 commit comments

Comments
 (0)