ADD: support Terminal in iCloudDriver

This commit is contained in:
rich2014 2025-03-01 18:14:22 +08:00
commit c15e209c8b
5 changed files with 23 additions and 15 deletions

View file

@ -49,7 +49,6 @@ type
function GetWatcher: TFileSourceWatcher; override;
function GetProcessor: TFileSourceProcessor; override;
function GetRealPath(const APath: String): String; virtual;
function GetVirtualPath(const APath: String): String; virtual;
class function CreateFile(const APath: String): TFile; override;
@ -363,11 +362,6 @@ begin
Result:= fileSystemFileSourceProcessor;
end;
function TFileSystemFileSource.GetRealPath(const APath: String): String;
begin
Result:= APath;
end;
function TFileSystemFileSource.GetVirtualPath(const APath: String): String;
begin
Result:= APath;

View file

@ -160,6 +160,7 @@ type
function GetRootDir: String; overload;
function GetPathType(sPath : String): TPathType;
function GetFreeSpace(Path: String; out FreeSize, TotalSize : Int64) : Boolean;
function GetRealPath(const path: String): String;
function GetLocalName(var aFile: TFile): Boolean;
function CreateDirectory(const Path: String): Boolean;
@ -361,6 +362,7 @@ type
function GetFreeSpace(Path: String; out FreeSize, TotalSize : Int64) : Boolean; virtual;
function QueryContextMenu(AFiles: TFiles; var AMenu: TPopupMenu): Boolean; virtual;
function GetDefaultView(out DefaultView: TFileSourceFields): Boolean; virtual;
function GetRealPath(const path: String): String; virtual;
function GetLocalName(var aFile: TFile): Boolean; virtual;
function GetConnection(Operation: TFileSourceOperation): TFileSourceConnection; virtual;
@ -692,6 +694,11 @@ begin
Result:= False;
end;
function TFileSource.GetRealPath(const path: String): String;
begin
Result:= path;
end;
function TFileSource.GetLocalName(var aFile: TFile): Boolean;
begin
Result:= False;

View file

@ -269,6 +269,7 @@ type
}
procedure FileSourceFileListUpdated; virtual;
function GetCurrentPath: String; virtual;
function GetCurrentRealPath: String; virtual;
procedure SetCurrentPath(NewPath: String); virtual;
function GetActiveDisplayFile: TDisplayFile; virtual; abstract;
function GetWorkersThread: TFunctionThread;
@ -527,6 +528,7 @@ type
property CurrentAddress: String read GetCurrentAddress;
property CurrentFileSourceIndex: Integer read GetCurrentFileSourceIndex;
property CurrentPath: String read GetCurrentPath write SetCurrentPath;
property CurrentRealPath: String read GetCurrentRealPath;
property CurrentPathIndex: Integer read GetCurrentPathIndex;
property CurrentLocation: String read GetCurrentLocation;
property FileFilter: String read FFileFilter;
@ -1577,6 +1579,11 @@ begin
Result := FHistory.CurrentPath;
end;
function TFileView.GetCurrentRealPath: String;
begin
Result:= FileSource.GetRealPath( CurrentPath );
end;
procedure TFileView.SetCurrentPath(NewPath: String);
begin
if (NewPath <> CurrentPath) and BeforeChangePath(FileSource, cprChange, NewPath) then

View file

@ -3848,7 +3848,7 @@ var
sParams: string = '';
sStartPath: string = '';
AElevate: TDuplicates = dupIgnore;
fs: TFileSystemFileSource;
fs: IFileSource;
begin
frmMain.ActiveFrame.ExecuteCommand('cm_EditNew', Params);
@ -3857,7 +3857,7 @@ begin
with frmMain do
if ActiveFrame.FileSource.IsClass(TFileSystemFileSource) then
begin
fs:= ActiveFrame.FileSource as TFileSystemFileSource;
fs:= ActiveFrame.FileSource;
aFile := ActiveFrame.CloneActiveFile;
if Assigned(aFile) then
try
@ -4032,7 +4032,7 @@ begin
with frmMain do
if not edtCommand.Focused then
try
ProcessExtCommandFork(gRunTermCmd, gRunTermParams, ActiveFrame.CurrentPath);
ProcessExtCommandFork(gRunTermCmd, gRunTermParams, ActiveFrame.CurrentRealPath);
except
on e: EInvalidCommandLine do
MessageDlg(rsToolErrorOpeningTerminal,

View file

@ -693,7 +693,7 @@ type
begin
state.files := leftFiles;
state.fil := leftFile;
state.dir := frmMain.FrameLeft.CurrentPath;
state.dir := frmMain.FrameLeft.CurrentRealPath;
state.address := frmMain.FrameLeft.CurrentAddress;
state.pos := spSide;
if sSourceStr[index] = 'b' then
@ -707,7 +707,7 @@ type
begin
state.files := rightFiles;
state.fil := rightFile;
state.dir := frmMain.FrameRight.CurrentPath;
state.dir := frmMain.FrameRight.CurrentRealPath;
state.address := frmMain.FrameRight.CurrentAddress;
state.pos := spSide;
end;
@ -908,10 +908,10 @@ begin
activeFiles := leftFiles;
activeFile:= leftFile;
inactiveFile:= rightFile;
activeDir := frmMain.FrameLeft.CurrentPath;
activeDir := frmMain.FrameLeft.CurrentRealPath;
activeAddress := frmMain.FrameLeft.CurrentAddress;
inactiveFiles := rightFiles;
inactiveDir := frmMain.FrameRight.CurrentPath;
inactiveDir := frmMain.FrameRight.CurrentRealPath;
inactiveAddress := frmMain.FrameRight.CurrentAddress;
end
else
@ -919,10 +919,10 @@ begin
activeFiles := rightFiles;
activeFile:= rightFile;
inactiveFile:= leftFile;
activeDir := frmMain.FrameRight.CurrentPath;
activeDir := frmMain.FrameRight.CurrentRealPath;
activeAddress := frmMain.FrameRight.CurrentAddress;
inactiveFiles := leftFiles;
inactiveDir := frmMain.FrameLeft.CurrentPath;
inactiveDir := frmMain.FrameLeft.CurrentRealPath;
inactiveAddress := frmMain.FrameLeft.CurrentAddress;
end;