fixed bug where directories in / couldn't be detected unless your home directory was /
This commit is contained in:
parent
4dfb01bb1d
commit
0caffa2b82
Binary file not shown.
|
@ -5056,6 +5056,7 @@ object frmMain: TfrmMain
|
||||||
'2111-1307 USA'
|
'2111-1307 USA'
|
||||||
' Everyone is permitted to copy and distribute verbatim copies'
|
' Everyone is permitted to copy and distribute verbatim copies'
|
||||||
' of this license document, but changing it is not allowed.'
|
' of this license document, but changing it is not allowed.'
|
||||||
|
''
|
||||||
#9#9#9' Preamble'
|
#9#9#9' Preamble'
|
||||||
' The licenses for most software are designed to take away your'
|
' The licenses for most software are designed to take away your'
|
||||||
|
|
||||||
|
|
|
@ -606,6 +606,7 @@ procedure TfrmMain.cmdConnectClick(Sender: TObject);
|
||||||
var i: integer;
|
var i: integer;
|
||||||
eStr: TStringList;
|
eStr: TStringList;
|
||||||
CurNode: TTreeNode;
|
CurNode: TTreeNode;
|
||||||
|
Path: String;
|
||||||
begin
|
begin
|
||||||
if (Trim(txtHost.Text) = '') or (Trim(txtUsername.Text) = '') then
|
if (Trim(txtHost.Text) = '') or (Trim(txtUsername.Text) = '') then
|
||||||
MessageBox(Handle, 'Please fill in each field!', PChar(Application.Title), MB_ICONWARNING)
|
MessageBox(Handle, 'Please fill in each field!', PChar(Application.Title), MB_ICONWARNING)
|
||||||
|
@ -630,29 +631,51 @@ begin
|
||||||
// ... connect and check values etc ...
|
// ... connect and check values etc ...
|
||||||
try
|
try
|
||||||
IdFTP.Connect(True, 15000);
|
IdFTP.Connect(True, 15000);
|
||||||
// ... scan for initial directory ...
|
// ... get initial directory ...
|
||||||
|
Path := IdFTP.RetrieveCurrentDir;
|
||||||
|
// ... "fix" path ...
|
||||||
eStr := TStringList.Create;
|
eStr := TStringList.Create;
|
||||||
eStr.Text := StringReplace(IdFTP.RetrieveCurrentDir, '/', #13, [rfReplaceAll]);
|
eStr.Text := StringReplace(Path, '/', #13, [rfReplaceAll]);
|
||||||
for i := eStr.Count -1 downto 0 do begin
|
for i := eStr.Count -1 downto 0 do begin
|
||||||
if eStr[i] = '' then
|
if eStr[i] = '' then
|
||||||
eStr.Delete(i);
|
eStr.Delete(i);
|
||||||
end;
|
end;
|
||||||
|
if (Copy(Path, Length(Path) -1, 1) <> '/') then
|
||||||
|
Path := Path + '/';
|
||||||
// ... connect successful, change captions ...
|
// ... connect successful, change captions ...
|
||||||
trvDirectories.Enabled := True;
|
trvDirectories.Enabled := True;
|
||||||
cmdConnect.Enabled := True;
|
cmdConnect.Enabled := True;
|
||||||
cmdConnect.Caption := 'Disconnect';
|
cmdConnect.Caption := 'Disconnect';
|
||||||
cmdCancel.Caption := '&Close';
|
cmdCancel.Caption := '&Close';
|
||||||
cmdNext.Enabled := True;
|
cmdNext.Enabled := True;
|
||||||
|
// ... change to / and create all the directories ...
|
||||||
CurNode := nil;
|
CurNode := nil;
|
||||||
if eStr.Count <> 0 then begin
|
if (Path <> '/') then begin
|
||||||
for i := 0 to eStr.Count -1 do
|
IdFTP.ChangeDir('/');
|
||||||
CurNode := trvDirectories.Items.AddChild(CurNode, eStr[i]);
|
with GetAllDirs do begin
|
||||||
|
for i := 0 to Count -1 do begin
|
||||||
|
if (Assigned(CurNode)) then
|
||||||
|
trvDirectories.Items.AddChild(trvDirectories.Items.Add(nil, Strings[i]), 'Scanning...')
|
||||||
|
else begin
|
||||||
|
CurNode := trvDirectories.Items.Add(nil, Strings[i]);
|
||||||
|
trvDirectories.Items.AddChild(CurNode, 'Scanning...');
|
||||||
|
if (Pos('/' + CurNode.Text + '/', Path) = 0) then
|
||||||
|
CurNode := nil;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
IdFTP.ChangeDir(Path);
|
||||||
end;
|
end;
|
||||||
if trvDirectories.Items.Count <> 0 then
|
// ... find directories in start path ...
|
||||||
trvDirectories.Items.Item[0].Expand(True);
|
if eStr.Count <> 0 then begin
|
||||||
|
for i := 0 to eStr.Count -1 do begin
|
||||||
|
if (not ((i = 0) and (Assigned(CurNode)))) then
|
||||||
|
CurNode := trvDirectories.Items.AddChild(CurNode, eStr[i]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
trvDirectories.Selected := CurNode;
|
||||||
eStr.Free;
|
eStr.Free;
|
||||||
|
|
||||||
// ... scan for directories ...
|
// ... scan for directories ...
|
||||||
with GetAllDirs do begin
|
with GetAllDirs do begin
|
||||||
for i := 0 to Count -1 do
|
for i := 0 to Count -1 do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user