mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: SFTP - open current directory when remote directory is not specified
This commit is contained in:
parent
4cdf3f0e6c
commit
fb40c7c4a9
1 changed files with 16 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
|||
-------------------------------------------------------------------------
|
||||
Wfx plugin for working with File Transfer Protocol
|
||||
|
||||
Copyright (C) 2013-2020 Alexander Koblov (alexx2000@mail.ru)
|
||||
Copyright (C) 2013-2024 Alexander Koblov (alexx2000@mail.ru)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -96,6 +96,8 @@ begin
|
|||
end;
|
||||
|
||||
function TSftpSend.Connect: Boolean;
|
||||
var
|
||||
Return: Integer;
|
||||
begin
|
||||
Result:= inherited Connect;
|
||||
|
||||
|
|
@ -105,6 +107,18 @@ begin
|
|||
|
||||
Result:= Assigned(FSFTPSession);
|
||||
|
||||
if Result and (Length(FCurrentDir) = 0) then
|
||||
begin
|
||||
SetLength(FCurrentDir, MAX_PATH + 1);
|
||||
Return:= libssh2_sftp_realpath(FSFTPSession, '.', PAnsiChar(FCurrentDir), MAX_PATH);
|
||||
if Return < 1 then
|
||||
FCurrentDir:= '/'
|
||||
else begin
|
||||
SetLength(FCurrentDir, Return);
|
||||
FCurrentDir:= CeUtf16ToUtf8(ServerToClient(FCurrentDir));
|
||||
end;
|
||||
end;
|
||||
|
||||
if not Result then begin
|
||||
libssh2_session_free(FSession);
|
||||
FSock.CloseSocket;
|
||||
|
|
@ -115,6 +129,7 @@ end;
|
|||
constructor TSftpSend.Create(const Encoding: String);
|
||||
begin
|
||||
inherited Create(Encoding);
|
||||
FCurrentDir:= EmptyStr;
|
||||
FCanResume := True;
|
||||
end;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue