On Dec 14, 2022, at 10:37 PM, André Tremblay <andre.t...@photographex.com> wrote:If I understand well, in the case of SuperCard, this shouldn't be necessary, as it will be possible for a second user to read from a project while the cantModify property of the project would be TRUE?
When a user needs to write to a project, the application should check the status of the cantModify property to be FALSE, which mean that the project isn't opened by another user and the DataForkOpen property would be FALSE?
if not the cantModify of proj someFile then put 123 into cd fld 1 of proj someFile
On Dec 14, 2022, at 10:37 PM, André Tremblay <andre.t...@photographex.com> wrote:
Should the cantModify property can be only TRUE or FALSE?
Is it possible for the cantModify property to return ZERO? A result I've seen when a project had been opened from a networked application? Or if a project had been simply checked with the fileBusy function from a networked application.
Also, is it normal that after a project had been checked with the fileBusy function from a networked application, this project becomes permanently 'busy' and the DataForkOpen property stayed 'OPEN', even after closing the project and even after quitting the application? The only way I found to release the projects is to unmount the networked volume on the computer on which reside the calling application! Which is mostly annoying!
I wonder why projects stay permanently opened with cantModify property to TRUE after closing the project?
SC first tries to open projects with write permission, but if that fails then it silently falls back to requesting read-only permission. I don't know offhand how many simultaneous read-only access paths Carbon permits (though presumably there's some hard limit that varies a bit by system version) as I've never heard of anyone actually running into it, but it's probably enough that you don't need to worry bout it here.
Whichever app instance succeeds in opening a file with write permission exclusively 'owns' the ability to write to the file until they close it again, but any other apps with read-only permission can read it irrespective of whether a write access path to the file exists (however they CANNOT subsequently convert any existing read-only access path they already have to a writable one).
When a user needs to write to a project, the application should check the status of the cantModify property to be FALSE, which mean that the project isn't opened by another user and the DataForkOpen property would be FALSE?If you check the cantModify of a project and it reports false, then by definition you've got exclusive write access. How LONG you can retain that for though depends on whether you keep the file open. In other words if you check the cantModify of an arbitrary closed project someplace on disk and it returns false, then at the moment SC reported the status it had managed to secure write access. But if the project wasn't already opened by the current SC instance when you checked its cantModify then by the time you try to open it AGAIN in the next statement write access might prove unavailable.Thus something like this will NOT reliably do what you seem to want for closed projects:if not the cantModify of proj someFile then put 123 into cd fld 1 of proj someFileInstead you'd need to first open the project and THEN test its cantModify to verify that it's currently writable from your app instance. If so write your change and promptly close it. If the project is NOT writable, then take a quick nap and try again. Depending on what each instance is looking to change (and how often), this might or might not work gracefully.Make sense?
Should the cantModify property can be only TRUE or FALSE?
I'm not sure I understand the question, but if I do then yes.
Is it possible for the cantModify property to return ZERO? A result I've seen when a project had been opened from a networked application? Or if a project had been simply checked with the fileBusy function from a networked application.
OK totally lost now. Why would/should cantModify return ZERO, what would it mean/enable, and what do you think fileBusy and the network have to do with this mess?
Also, is it normal that after a project had been checked with the fileBusy function from a networked application, this project becomes permanently 'busy' and the DataForkOpen property stayed 'OPEN', even after closing the project and even after quitting the application? The only way I found to release the projects is to unmount the networked volume on the computer on which reside the calling application! Which is mostly annoying!
FileBusy doesn't actually open (or even touch) the target project, it just calls the Toolbox FSGetCatalogInfo routine to fetch its file system node info flags from its host volume's catalog tree. These let it report back to SC which forks if any are open, but alas not with what permission.
I wonder why projects stay permanently opened with cantModify property to TRUE after closing the project?
That doesn't sound right. Can you send me a sample (or at least more details/clues)?
On Dec 15, 2022, at 9:42 PM, André Tremblay <andre.t...@photographex.com> wrote:The network is gigabit ethernet and the projects' volume are mounted with SMB protocol for B and C. The projects are on a local volume for A.
Le 16-déc.-2022 à 16:01:13, 'MARK LUCAS' via SuperCard Discussion <superca...@googlegroups.com> a écrit :In my testing here SMB appears to be the proximate cause of the glitch - if I unmount everything and then switch File Sharing back to use AFP (in System Prefs->Sharing->Options) at both ends then FileBusy seems to work as expected again.
Unfortunately I wouldn't be surprised if sharing APFS volumes over AFP isn't supported though, but that may not be an issue for you.
Can you check whether this is feasible (at least temporarily on two or more of your systems) and if so whether it has any effect on the problem?
In the meantime I'll keep trying to figure out another way to skin this cat…