made it a little safer

This commit is contained in:
Christian Hammacher 2007-02-12 19:35:01 +00:00
parent 0caffa2b82
commit 811265e28b
2 changed files with 20 additions and 13 deletions

Binary file not shown.

View File

@ -651,21 +651,28 @@ begin
// ... change to / and create all the directories ... // ... change to / and create all the directories ...
CurNode := nil; CurNode := nil;
if (Path <> '/') then begin if (Path <> '/') then begin
IdFTP.ChangeDir('/'); try
with GetAllDirs do begin IdFTP.ChangeDir('/');
for i := 0 to Count -1 do begin with GetAllDirs do begin
if (Assigned(CurNode)) then for i := 0 to Count -1 do begin
trvDirectories.Items.AddChild(trvDirectories.Items.Add(nil, Strings[i]), 'Scanning...') if (Assigned(CurNode)) then
else begin trvDirectories.Items.AddChild(trvDirectories.Items.Add(nil, Strings[i]), 'Scanning...')
CurNode := trvDirectories.Items.Add(nil, Strings[i]); else begin
trvDirectories.Items.AddChild(CurNode, 'Scanning...'); CurNode := trvDirectories.Items.Add(nil, Strings[i]);
if (Pos('/' + CurNode.Text + '/', Path) = 0) then trvDirectories.Items.AddChild(CurNode, 'Scanning...');
CurNode := nil; if (Pos('/' + CurNode.Text + '/', Path) = 0) then
end CurNode := nil;
end
end;
Free;
end; end;
Free; IdFTP.ChangeDir(Path);
except
if (IdFTP.Connected) then
IdFTP.ChangeDir(Path)
else
IdFTP.Connect;
end; end;
IdFTP.ChangeDir(Path);
end; end;
// ... find directories in start path ... // ... find directories in start path ...
if eStr.Count <> 0 then begin if eStr.Count <> 0 then begin