diff --git a/Vfs.dproj b/Vfs.dproj
index cbaa36b..2de826e 100644
--- a/Vfs.dproj
+++ b/Vfs.dproj
@@ -30,7 +30,11 @@
Delphi.Personality
VCLApplication
-FalseTrueFalseTrueTrue1010FalseFalseFalseFalseFalse10491251Alexander Shostak (aka EtherniDee)Virtual File System1.0.1.01.0.0.0Vfs.dpr
+FalseTrueFalseTrueTrue1020FalseFalseFalseFalseFalse10491251Alexander Shostak (aka EtherniDee)Virtual File System1.0.2.01.0.0.0Vfs.dpr
+
+
+
+
Microsoft Office 2000 Sample Automation Server Wrapper Components
diff --git a/Vfs.res b/Vfs.res
index 9d145b4..44bbf33 100644
Binary files a/Vfs.res and b/Vfs.res differ
diff --git a/VfsBase.pas b/VfsBase.pas
index 6e032ed..a922ffc 100644
--- a/VfsBase.pas
+++ b/VfsBase.pas
@@ -48,6 +48,9 @@ type
(* Name in lower case, used for wildcard mask matching *)
SearchName: WideString;
+ (* Absolute path to virtual file/folder location without trailing slash for non-drives *)
+ VirtPath: WideString;
+
(* Absolute path to real file/folder location without trailing slash for non-drives *)
RealPath: WideString;
@@ -130,6 +133,10 @@ function CallWithoutVfs (Func: TSingleArgExternalFunc; Arg: pointer = nil): inte
of real and virtual paths is stripped *)
function GetMappingsReport: WideString;
+(* Returns text with all applied mappings on per-file level, separated via #13#10. If ShortenPaths is true, common part
+ of real and virtual paths is stripped *)
+function GetDetailedMappingsReport: WideString;
+
(***) implementation (***)
@@ -517,6 +524,7 @@ begin
CopyFileInfoWithoutNames(FileInfo.Base, VfsItem.Info.Base);
end;
+ VfsItem.VirtPath := AbsVirtPath;
VfsItem.RealPath := AbsRealPath;
VfsItem.Priority := Priority;
VfsItem.Attrs := 0;
@@ -569,7 +577,7 @@ begin
with SysScanDir(AbsRealPath, '*') do begin
while IterNext(FileInfo.FileName, @FileInfo.Base) do begin
- if Utils.HasFlag(FileInfo.Base.FileAttributes, Windows.FILE_ATTRIBUTE_DIRECTORY) then begin
+ if Utils.HasFlag(Windows.FILE_ATTRIBUTE_DIRECTORY, FileInfo.Base.FileAttributes) then begin
if (FileInfo.FileName <> '.') and (FileInfo.FileName <> '..') then begin
Subdirs.Add(TFileInfo.Create(@FileInfo));
end;
@@ -693,7 +701,7 @@ begin
end; // .with
end; // .function RefreshMappedFile
-function GetMappingsReport: WideString;
+function GetMappingsReport_ (Mappings: TList {of TMapping}): WideString;
const
COL_PATHS = 0;
COL_META = 1;
@@ -811,7 +819,51 @@ begin
// * * * * * //
SysUtils.FreeAndNil(Buf);
SysUtils.FreeAndNil(Line);
-end; // .function GetMappingsReport
+end; // .function GetMappingsReport_
+
+function GetMappingsReport: WideString;
+begin
+ with VfsCritSection do begin
+ Enter;
+ result := GetMappingsReport_(Mappings);
+ Leave;
+ end;
+end;
+
+function CompareMappingsByRealPath (A, B: integer): integer;
+begin
+ result := StrLib.CompareBinStringsW(TMapping(A).AbsRealPath, TMapping(B).AbsRealPath);
+end;
+
+function GetDetailedMappingsReport: WideString;
+var
+{O} DetailedMappings: {O} TList {of TMapping};
+{Un} VfsItem: TVfsItem;
+
+begin
+ DetailedMappings := DataLib.NewList(Utils.OWNS_ITEMS);
+ VfsItem := nil;
+ // * * * * * //
+ with VfsCritSection do begin
+ Enter;
+
+ with DataLib.IterateDict(VfsItems) do begin
+ while IterNext do begin
+ VfsItem := TVfsItem(IterValue);
+
+ // Note, item Attrs is not the same as directory mapping Flags
+ DetailedMappings.Add(TMapping.Make(true, VfsItem.VirtPath, VfsItem.RealPath, false, VfsItem.Attrs));
+ end;
+ end;
+
+ Leave;
+ end;
+
+ DetailedMappings.CustomSort(CompareMappingsByRealPath);
+ result := GetMappingsReport_(DetailedMappings);
+ // * * * * * //
+ SysUtils.FreeAndNil(DetailedMappings);
+end;
begin
VfsCritSection.Init;
diff --git a/VfsExport.pas b/VfsExport.pas
index 36ccdcf..13cc881 100644
--- a/VfsExport.pas
+++ b/VfsExport.pas
@@ -24,6 +24,26 @@ exports
(***) implementation (***)
+function Externalize (const Str: AnsiString): {O} pointer; overload;
+begin
+ result := nil;
+
+ if Str <> '' then begin
+ GetMem(result, Length(Str) + 1);
+ Utils.CopyMem(Length(Str) + 1, pointer(Str), result);
+ end;
+end;
+
+function Externalize (const Str: WideString): {O} pointer; overload;
+begin
+ result := nil;
+
+ if Str <> '' then begin
+ GetMem(result, (Length(Str) + 1) * sizeof(WideChar));
+ Utils.CopyMem((Length(Str) + 1) * sizeof(WideChar), pointer(Str), result);
+ end;
+end;
+
function MapDir (const VirtPath, RealPath: PWideChar; OverwriteExisting: boolean; Flags: integer = 0): LONGBOOL; stdcall;
begin
result := VfsBase.MapDir(WideString(VirtPath), WideString(RealPath), OverwriteExisting, Flags);
@@ -63,25 +83,25 @@ end;
(* Returns text with all applied mappings, separated via #13#10. If ShortenPaths is true, common part
of real and virtual paths is stripped. Call MemFree to release result buffer *)
function GetMappingsReport: {O} PWideChar; stdcall;
-var
- Res: WideString;
-
begin
- result := nil;
- Res := VfsBase.GetMappingsReport;
- GetMem(result, (Length(Res) + 1) * sizeof(WideChar));
- Utils.CopyMem((Length(Res) + 1) * sizeof(WideChar), PWideChar(Res), result);
+ result := Externalize(VfsBase.GetMappingsReport);
end;
function GetMappingsReportA: {O} pchar; stdcall;
-var
- Res: string;
-
begin
- result := nil;
- Res := VfsBase.GetMappingsReport;
- GetMem(result, Length(Res) + 1);
- Utils.CopyMem(Length(Res) + 1, pchar(Res), result);
+ result := Externalize(AnsiString(VfsBase.GetMappingsReport));
+end;
+
+(* Returns text with all applied mappings on per-file level, separated via #13#10. If ShortenPaths is true, common part
+ of real and virtual paths is stripped *)
+function GetDetailedMappingsReport: {O} PWideChar; stdcall;
+begin
+ result := Externalize(VfsBase.GetDetailedMappingsReport);
+end;
+
+function GetDetailedMappingsReportA: {O} pchar; stdcall;
+begin
+ result := Externalize(AnsiString(VfsBase.GetDetailedMappingsReport));
end;
procedure ConsoleLoggingProc (Operation, Message: pchar); stdcall;
@@ -127,6 +147,8 @@ exports
RunWatcherA,
GetMappingsReport,
GetMappingsReportA,
+ GetDetailedMappingsReport,
+ GetDetailedMappingsReportA,
MemFree,
InstallConsoleLogger;
diff --git a/VfsImport.pas b/VfsImport.pas
index 7aea5f6..ff672a5 100644
--- a/VfsImport.pas
+++ b/VfsImport.pas
@@ -51,6 +51,11 @@ procedure MemFree ({O} Buf: pointer); stdcall; external 'vfs.dll';
function GetMappingsReport: {O} PWideChar; stdcall; external 'vfs.dll';
function GetMappingsReportA: {O} pchar; stdcall; external 'vfs.dll';
+(* Returns text with all applied mappings on per-file level, separated via #13#10. If ShortenPaths is true, common part
+ of real and virtual paths is stripped *)
+function GetDetailedMappingsReport: {O} PWideChar; stdcall; external 'vfs.dll';
+function GetDetailedMappingsReportA: {O} pchar; stdcall; external 'vfs.dll';
+
(* Allocates console and install logger, writing messages to console *)
procedure InstallConsoleLogger; stdcall; external 'vfs.dll';