UPD: FTP - assign connection remote path as virtual drive root (issue #1665)

This commit is contained in:
Alexander Koblov 2024-09-29 14:55:14 +03:00
commit 67c5d3a2b1
2 changed files with 9 additions and 1 deletions

View file

@ -119,6 +119,7 @@ type
constructor Create(const Encoding: String); virtual; reintroduce;
function Login: Boolean; override;
function Clone: TFTPSendEx; virtual;
function GetCurrentDir: String; override;
procedure CloneTo(AValue: TFTPSendEx); virtual;
procedure ParseRemote(Value: string); override;
function FileExists(const FileName: String): Boolean; virtual;
@ -769,6 +770,11 @@ begin
end;
end;
function TFTPSendEx.GetCurrentDir: String;
begin
Result:= CeUtf16ToUtf8(ServerToClient(inherited GetCurrentDir));
end;
function TFTPSendEx.FileExists(const FileName: String): Boolean;
begin
Result:= (Self.FileSize(FileName) >= 0);

View file

@ -310,6 +310,7 @@ end;
function FtpConnect(const ConnectionName: AnsiString; out FtpSend: TFTPSendEx): Boolean;
var
I: Integer;
APath: String;
APassword: String;
Connection: TConnection;
begin
@ -403,7 +404,8 @@ begin
end
else begin
Connection.CachedPassword:= APassword;
LogProc(PluginNumber, MSGTYPE_CONNECT, PWideChar('CONNECT ' + PathDelim + CeUtf8ToUtf16(ConnectionName)));
APath:= PathDelim + ConnectionName + FtpSend.GetCurrentDir;
LogProc(PluginNumber, MSGTYPE_CONNECT, PWideChar('CONNECT ' + CeUtf8ToUtf16(APath)));
ActiveConnectionList.AddObject(ConnectionName, FtpSend);
if Connection.OpenSSH and (ConnectionName <> cQuickConnection) then
begin