Wish Prevent Same File from opening twice with .lock

jmon

Well-Known Member
Licensed User
Longtime User
Hello,

A while ago I asked if possible to prevent the same file from opening twice or more : https://www.b4x.com/android/forum/threads/opening-the-same-file-dont-open-in-a-new-window.38583/
I can imaging it's quite difficult to implement, as each .b4x file is opened in a different process.

Even though I try to discipline myself as much as possible and check in the taskbar that I didn't open a b4j file already before opening a new file, I still encounter this problem. On big projects, I get lost, and open the same file twice, then it's difficult for me to find which one should I save or not, afraid to overwrite the one I worked on..

To palliate this problem, I have an idea: adding a .lock file.

Each time we open a .b4x file, a .lock file is created, when closing, it is deleted:
B4X:
myproject.b4j
myproject.b4j.meta
myproject.b4j.lock

if the IDE detects a lock file, it could pop-up a message, warning the user that the file is opened somewhere, give the option to open anyway (and delete the lock) or to cancel. If the process crashes and the .lock is not deleted, we could click "open anyway", or manualy delete the .lock.

This system is implemented exactly like that in a 3d Tracking program: Pixel Farm PFTrack (their files are named .prjlock).

also an alternative, for multi-user projects (with remote shares) is this:
B4X:
myproject.b4j
myproject.b4j.meta
myproject.b4j.lock.computername
adding a .lock.computerName, so we could know who has the file opened.

this .lock security could be turned off by default to not confuse people, but the option to activate it could be given in /tools/IDE Options/...

For me, opening the same file multiple time is one major problem I encounter several times. Maybe there are other ways to palliate this problem, I'm ok for any suggestion :)

Thanks again for all the work done on b4x. Best wishes for 2017!

Jmon
 
Top