ADD/StashFS: step-17: support search in Stash

This commit is contained in:
rich2014 2026-06-05 22:14:41 +08:00
commit 744a272ba7
2 changed files with 18 additions and 2 deletions

View file

@ -105,7 +105,7 @@ end;
function TSearchResultFileSource.GetRootDir(sPath: String): String;
begin
Result:= PathDelim + PathDelim + PathDelim + rsSearchResult + PathDelim;
Result:= PathDelim + PathDelim + PathDelim + rsSearchResult + PathDelim;
end;
function TSearchResultFileSource.GetProperties: TFileSourceProperties;
@ -175,7 +175,7 @@ var
begin
if paths.Count > 0 then
Exit;
files:= self.GetFiles( self.GetRootDir(EmptyStr) );
files:= self.GetFiles( self.GetRootDir );
for i:= 0 to files.Count-1 do
paths.Add( files[i].FullPath );
files.Free;

View file

@ -65,6 +65,7 @@ type
function CreateSetFilePropertyOperation(var theTargetFiles: TFiles; var theNewProperties: TFileProperties): TFileSourceOperation; override;
function QueryContextMenu(AFiles: TFiles; var AMenu: TPopupMenu): Boolean; override;
procedure AddSearchPath( const startPath: String; paths: TStringList); override;
end;
implementation
@ -412,6 +413,21 @@ begin
end;
end;
procedure TStashFileSource.AddSearchPath(
const startPath: String;
paths: TStringList );
var
files: TFiles;
i: Integer;
begin
if paths.Count > 0 then
Exit;
files:= self.GetFiles( self.GetRootDir );
for i:= 0 to files.Count-1 do
paths.Add( files[i].FullPath );
files.Free;
end;
initialization
stashFileSourceProcessor:= TStashFileSourceProcessor.Create;
RegisterVirtualFileSource( STASH_NAME, STASH_SCHEME, TStashFileSource, True );