which is fine if you are OK doing manual clean-up when, not if, if the
stack should ever exit without 'quit'ing, or become disconnected from
the network, or ... any of which would leave the file-flag behind.
The easiest alternative is to have the stack update the file
periodically, and instead of checking for the file's existence, check
how up-to-date it is. Do the update this periodically (maybe every
minute, every 5 minutes , ...) and if the file exists but is old by more
than 3 * the chosen interval then delete the file and continue. (And do
be careful of time drift between different machines).
Alex.
On 26/01/2021 01:06, Paul Dupuis via use-livecode wrote:
If the could storage the stack is on has write access, the easiest
mechanism is a file based flag.
When the stack is launched, if checks:
if there is a file <filespec> then
-- the stack is already open, so exit
else
put empty into URL ("file:"&<filespec>) -- creates a empty file to
mark as open
end
and when the stack exists remove the file
on quit
delete file <filespec>
end quit
Or something like that. I do not have LC open to check my code above.
On 1/25/2021 7:24 PM, Marty Knapp via use-livecode wrote:
I have an app that allows user to create specialized editable
documents (stacks) that open in my app. Some customers use Dropbox,
iCloud, OneDrive or similar to store these documents so that they can
be accessed from 2 different computers. Is there a way to tell if a
stack is already open on one computer? I need to prevent them from
opening a 2nd instance of the stack on the other computer so that
Dropbox (or other cloud sync service) does not create a conflicted copy.
If there is not a way to tell, has anyone created some sort of stack
check-out/check-in system that they'd be willing to share? I need
this for Mac, PC and mixed.
Marty
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode