mirror of
https://github.com/CloudDelphi/Virtual-File-System
synced 2025-12-19 09:53:54 +01:00
Fixed bug: DisableVfsForThisThread made VFS control API to fail
This commit is contained in:
parent
d67a8ae4f9
commit
7cb8c94406
20
VfsBase.pas
20
VfsBase.pas
@ -343,9 +343,8 @@ end;
|
|||||||
|
|
||||||
function RunVfs (DirListingOrder: TDirListingSortType): boolean;
|
function RunVfs (DirListingOrder: TDirListingSortType): boolean;
|
||||||
begin
|
begin
|
||||||
result := not DisableVfsForThisThread;
|
result := true;
|
||||||
|
|
||||||
if result then begin
|
|
||||||
with VfsCritSection do begin
|
with VfsCritSection do begin
|
||||||
Enter;
|
Enter;
|
||||||
|
|
||||||
@ -362,27 +361,23 @@ begin
|
|||||||
|
|
||||||
Leave;
|
Leave;
|
||||||
end; // .with
|
end; // .with
|
||||||
end; // .if
|
|
||||||
end; // .function RunVfs
|
end; // .function RunVfs
|
||||||
|
|
||||||
function PauseVfs: LONGBOOL; stdcall;
|
function PauseVfs: LONGBOOL; stdcall;
|
||||||
begin
|
begin
|
||||||
result := not DisableVfsForThisThread;
|
result := true;
|
||||||
|
|
||||||
if result then begin
|
|
||||||
with VfsCritSection do begin
|
with VfsCritSection do begin
|
||||||
Enter;
|
Enter;
|
||||||
VfsIsRunning := false;
|
VfsIsRunning := false;
|
||||||
Leave;
|
Leave;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
function ResetVfs: LONGBOOL; stdcall;
|
function ResetVfs: LONGBOOL; stdcall;
|
||||||
begin
|
begin
|
||||||
result := not DisableVfsForThisThread;
|
result := true;
|
||||||
|
|
||||||
if result then begin
|
|
||||||
with VfsCritSection do begin
|
with VfsCritSection do begin
|
||||||
Enter;
|
Enter;
|
||||||
VfsItems.Clear;
|
VfsItems.Clear;
|
||||||
@ -393,7 +388,6 @@ begin
|
|||||||
Leave;
|
Leave;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
function IsVfsActive: boolean;
|
function IsVfsActive: boolean;
|
||||||
begin
|
begin
|
||||||
@ -631,9 +625,6 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
result := not DisableVfsForThisThread;
|
|
||||||
|
|
||||||
if result then begin
|
|
||||||
with VfsCritSection do begin
|
with VfsCritSection do begin
|
||||||
Enter;
|
Enter;
|
||||||
result := VfsTreeIsBuilt;
|
result := VfsTreeIsBuilt;
|
||||||
@ -661,7 +652,6 @@ begin
|
|||||||
|
|
||||||
Leave;
|
Leave;
|
||||||
end; // .with
|
end; // .with
|
||||||
end; // .if
|
|
||||||
end; // .function RefreshVfs
|
end; // .function RefreshVfs
|
||||||
|
|
||||||
function RefreshMappedFile (const FilePath: WideString): boolean;
|
function RefreshMappedFile (const FilePath: WideString): boolean;
|
||||||
@ -674,9 +664,6 @@ var
|
|||||||
begin
|
begin
|
||||||
VfsItem := nil;
|
VfsItem := nil;
|
||||||
// * * * * * //
|
// * * * * * //
|
||||||
result := not DisableVfsForThisThread;
|
|
||||||
|
|
||||||
if result then begin
|
|
||||||
with VfsCritSection do begin
|
with VfsCritSection do begin
|
||||||
Enter;
|
Enter;
|
||||||
result := VfsTreeIsBuilt;
|
result := VfsTreeIsBuilt;
|
||||||
@ -697,7 +684,6 @@ begin
|
|||||||
|
|
||||||
Leave;
|
Leave;
|
||||||
end; // .with
|
end; // .with
|
||||||
end; // .if
|
|
||||||
end; // .function RefreshMappedFile
|
end; // .function RefreshMappedFile
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -10,7 +10,7 @@ unit VfsWatching;
|
|||||||
uses
|
uses
|
||||||
Windows, SysUtils, Math,
|
Windows, SysUtils, Math,
|
||||||
Utils, Concur, WinUtils, StrLib, WinNative,
|
Utils, Concur, WinUtils, StrLib, WinNative,
|
||||||
VfsBase, VfsUtils, {FIXME} DlgMes;
|
VfsBase, VfsUtils;
|
||||||
|
|
||||||
|
|
||||||
(* Spawns separate thread, which starts recursive monitoring for changes in specified directory.
|
(* Spawns separate thread, which starts recursive monitoring for changes in specified directory.
|
||||||
@ -253,7 +253,6 @@ begin
|
|||||||
if NeedFullRescan and (PlannedRescanTime <= CurrentTime) then begin
|
if NeedFullRescan and (PlannedRescanTime <= CurrentTime) then begin
|
||||||
VfsBase.RefreshVfs;
|
VfsBase.RefreshVfs;
|
||||||
NeedFullRescan := false;
|
NeedFullRescan := false;
|
||||||
VarDump(['Fully rescanned']);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if DirChangesScanner = nil then begin
|
if DirChangesScanner = nil then begin
|
||||||
@ -283,7 +282,6 @@ begin
|
|||||||
end else if DirChange.Action = NOTIFY_FILE_MODIFIED then begin
|
end else if DirChange.Action = NOTIFY_FILE_MODIFIED then begin
|
||||||
if not NeedFullRescan then begin
|
if not NeedFullRescan then begin
|
||||||
VfsBase.RefreshMappedFile(DirChange.FilePath);
|
VfsBase.RefreshMappedFile(DirChange.FilePath);
|
||||||
VarDump(['Updated ' + DirChange.FilePath]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
LastChangeTime := WinUtils.GetMicroTime;
|
LastChangeTime := WinUtils.GetMicroTime;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user