Ver código fonte

FIX: WfxPluginListOperation

Alexander Koblov 16 anos atrás
pai
commit
17afec14b7
2 arquivos alterados com 21 adições e 4 exclusões
  1. 6 4
      src/newdesign/uwfxpluginlistoperation.pas
  2. 15 0
      src/udcutils.pas

+ 6 - 4
src/newdesign/uwfxpluginlistoperation.pas

@@ -19,6 +19,7 @@ type
   private
     FWfxPluginFileSource: IWfxPluginFileSource;
     FCallbackDataClass: TCallbackDataClass;
+    FCurrentPath: UTF8String;
   public
     constructor Create(aFileSource: IFileSource; aPath: String); override;
     destructor Destroy; override;
@@ -31,7 +32,7 @@ type
 implementation
 
 uses
-  LCLProc, FileUtil, uOSUtils, uWfxPluginFile, uFile,
+  LCLProc, FileUtil, uOSUtils, uDCUtils, uWfxPluginFile, uFile,
   WfxPlugin, uWfxModule;
 
 constructor TWfxPluginListOperation.Create(aFileSource: IFileSource; aPath: String);
@@ -39,6 +40,7 @@ begin
   FFiles := TFiles.Create;
   FWfxPluginFileSource := aFileSource as IWfxPluginFileSource;
   FCallbackDataClass:= TCallbackDataClass.Create;
+  FCurrentPath:= ExcludeBackPathDelimiter(aPath);
   inherited Create(aFileSource, aPath);
 end;
 
@@ -54,7 +56,7 @@ begin
   FCallbackDataClass.FileSource:= FWfxPluginFileSource;
   with FWfxPluginFileSource do
   begin
-    WfxModule.WfxStatusInfo(Path, FS_STATUS_START, FS_STATUS_OP_LIST);
+    WfxModule.WfxStatusInfo(FCurrentPath, FS_STATUS_START, FS_STATUS_OP_LIST);
     WfxOperationList.Objects[PluginNumber]:= FCallbackDataClass;
   end;
 end;
@@ -82,7 +84,7 @@ begin
       FFiles.Add(aFile);
     end;
 
-    Handle := WfxFindFirst(sPath, FindData);
+    Handle := WfxFindFirst(FCurrentPath, FindData);
     if Handle = feInvalidHandle then Exit;
     repeat
       if (FindData.FileName = '.') or (FindData.FileName = '..') then Continue;
@@ -101,7 +103,7 @@ procedure TWfxPluginListOperation.Finalize;
 begin
   with FWfxPluginFileSource do
   begin
-    WfxModule.WfxStatusInfo(Path, FS_STATUS_END, FS_STATUS_OP_LIST);
+    WfxModule.WfxStatusInfo(FCurrentPath, FS_STATUS_END, FS_STATUS_OP_LIST);
     WfxOperationList.Objects[PluginNumber]:= nil;
   end;
 end;

+ 15 - 0
src/udcutils.pas

@@ -203,6 +203,10 @@ function ExtractDirLevel(const sPrefix, sPath: String): String;
    Removes a path delimiter at the beginning of the string, if it exists.
 }
 function ExcludeFrontPathDelimiter(s: String): String;
+{en
+   Removes a path delimiter at the ending of the string, if it exists.
+}
+function ExcludeBackPathDelimiter(const Path: UTF8String): UTF8String;
 
 {en
    Return position of character in string begun from start position
@@ -743,6 +747,17 @@ begin
     Result := s;
 end;
 
+function ExcludeBackPathDelimiter(const Path: UTF8String): UTF8String;
+var
+  L: Integer;
+begin
+  L:= Length(Path);
+  if (L > 1) and (Path[L] in AllowDirectorySeparators) then
+    Result:= Copy(Path, 1, L - 1)
+  else
+    Result:= Path;
+end;
+
 procedure DivFileName(const sFileName:String; out n,e:String);
 var
   i:Integer;