ToddFrankson 7 Posted March 18 So I use the following code on windows: ... FileMk:THandle ... If ((FileMk=INVALID_HANDLE_VALUE ) and System.SysUtils.FileExists(tempName)) then FileMk:=FileOpen(tempName,fmExclusive or fmShareExclusive); ... Works Fine on windows. For the average person they can't copy the file, open the file, rename the file, etc.... It doesn't work on MACOS. I have been looking all over the interwebs and really haven't found much. Does anyone know how to accomplish the same feat on MacOS? Share this post Link to post
Rollo62 562 Posted March 19 As far as I know supports MacOS only advisory locks. https://developer.apple.com/forums/thread/709905 Share this post Link to post
Der schöne Günther 332 Posted March 19 I cannot contribute how to solve this, but having dealt mostly with Windows I also was surprised recently to find out about how differently this is handled on other platforms like macOS or Linux. Delphi's standard library was initially built for Windows and suggests you could easily enforce this on other platforms as well. For other languages like C++ or Rust, the standard library's file access mechanism don't even support any way "sharing" or "locking". Their default implementation is even "Don't lock anything, allow everything" which I found surprising. Maybe that was just my old Windows habits. Share this post Link to post
ToddFrankson 7 Posted March 19 3 hours ago, Rollo62 said: As far as I know supports MacOS only advisory locks. https://developer.apple.com/forums/thread/709905 Thanks, I found that too. I was hoping it was not accurate.... Now to look for another way to do what I need.... Share this post Link to post
ToddFrankson 7 Posted March 19 1 hour ago, Der schöne Günther said: I cannot contribute how to solve this, but having dealt mostly with Windows I also was surprised recently to find out about how differently this is handled on other platforms like macOS or Linux. Me too. Some of the other platforms make no sense to me. Especially the API's Share this post Link to post