Browse Source

ADD: Verify after copy under macOS

Alexander Koblov 1 năm trước cách đây
mục cha
commit
2c94aa22b8

+ 21 - 1
components/doublecmd/dcosutils.pas

@@ -3,7 +3,7 @@
     -------------------------------------------------------------------------
     This unit contains platform dependent functions dealing with operating system.
 
-    Copyright (C) 2006-2023 Alexander Koblov ([email protected])
+    Copyright (C) 2006-2024 Alexander Koblov ([email protected])
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -873,6 +873,16 @@ begin
   if Result <> feInvalidHandle then
   begin
     FileCloseOnExec(Result);
+{$IF DEFINED(DARWIN)}
+    if (Mode and fmOpenDirect <> 0) then
+    begin
+      if (FpFcntl(Result, F_NOCACHE, 1) = -1) then
+      begin
+        FileClose(Result);
+        Exit(feInvalidHandle);
+      end;
+    end;
+{$ENDIF}
     Result:= FileLock(Result, Mode and $FF);
   end;
 end;
@@ -904,6 +914,16 @@ begin
   if Result <> feInvalidHandle then
   begin
     FileCloseOnExec(Result);
+{$IF DEFINED(DARWIN)}
+    if (Mode and fmOpenDirect <> 0) then
+    begin
+      if (FpFcntl(Result, F_NOCACHE, 1) = -1) then
+      begin
+        FileClose(Result);
+        Exit(feInvalidHandle);
+      end;
+    end;
+{$ENDIF}
     Result:= FileLock(Result, Mode and $FF);
   end;
 end;

+ 4 - 1
components/doublecmd/dcunix.pas

@@ -3,7 +3,7 @@
    -------------------------------------------------------------------------
    This unit contains Unix specific functions
 
-   Copyright (C) 2015-2023 Alexander Koblov ([email protected])
+   Copyright (C) 2015-2024 Alexander Koblov ([email protected])
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -48,6 +48,9 @@ const
 {$ELSEIF DEFINED(HAIKU)}
   FD_CLOEXEC = 1;
   O_CLOEXEC  = $00000040;
+{$ELSEIF DEFINED(DARWIN)}
+  O_CLOEXEC  = $1000000;
+  F_NOCACHE  = 48;
 {$ELSE}
   O_CLOEXEC  = 0;
 {$ENDIF}

+ 0 - 4
src/filesources/filesystem/ffilesystemcopymoveoperationoptions.pas

@@ -112,10 +112,6 @@ constructor TFileSystemCopyMoveOperationOptionsUI.Create(AOwner: TComponent; AFi
 begin
   inherited;
 
-  {$IFDEF DARWIN}
-  chkVerify.Visible := False;
-  {$ENDIF}
-
   {$IFDEF MSWINDOWS}
   cbCopyOwnership.Visible := False;
   cbCopyPermissions.Visible := True;