ADD: TFileSystemWatcher.Features function

(cherry picked from commit 24838d18f3)
This commit is contained in:
Alexander Koblov 2023-11-04 14:18:53 +03:00
commit f96767c13d
2 changed files with 15 additions and 2 deletions

View file

@ -235,7 +235,8 @@ uses
LCLIntf, LCLProc, LazUTF8, Forms, Dialogs, Buttons, DCOSUtils, DCStrUtils,
fMain, uShowMsg, uLng, uFileProperty, uFileSource, uFileSourceOperationTypes,
uGlobs, uInfoToolTip, uDisplayFile, uFileSystemFileSource, uFileSourceUtil,
uArchiveFileSourceUtil, uFormCommands, uKeyboard, uFileSourceSetFilePropertyOperation;
uArchiveFileSourceUtil, uFormCommands, uKeyboard, uFileSourceSetFilePropertyOperation,
uFileSystemWatcher;
type
TControlHandlersHack = class(TWinControl)
@ -353,7 +354,7 @@ begin
begin
// FRenameFile is nil when a file list
// already updated by the real 'rename' event
if FlatView and Assigned(FRenameFile) then
if FlatView and Assigned(FRenameFile) and (TFileSystemWatcher.Features * [fsfFlatView] = []) then
begin
PushRenameEvent(FRenameFile, NewFileName);
end;

View file

@ -46,6 +46,8 @@ type
fswUnknownChange);
TFSWatcherEventTypes = set of TFSWatcherEventType;
TFSFeatures = set of (fsfFlatView);
TFSWatcherEventData = record
Path: String;
EventType: TFSWatcherEventType;
@ -82,6 +84,7 @@ type
{$ENDIF}
class function CanWatch(const WatchPaths: array of String): Boolean;
class function AvailableWatchFilter: TFSWatchFilter;
class function Features: TFSFeatures;
end;
implementation
@ -388,6 +391,15 @@ begin
];
end;
class function TFileSystemWatcher.Features: TFSFeatures;
begin
Result := [
{$IF DEFINED(DARWIN)}
fsfFlatView
{$ENDIF}
];
end;
// ----------------------------------------------------------------------------
procedure ShowError(const sErrMsg: String);