Lock file to prevent simultaneous edits

General discussions about Inkscape.
neex101
Posts: 2
Joined: Wed Jun 13, 2018 9:30 pm

Lock file to prevent simultaneous edits

Postby neex101 » Wed Jun 13, 2018 9:35 pm

Hi!

Can inkscape generate a lock file when it opens, to prevent someone else opening that file?

I need this to prevent accidental loss of work - two of our team open the same file on our server, make different edits and save. The one who saves first loses their work.

Many thanks,
Ed

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Lock file to prevent simultaneous edits

Postby brynn » Thu Jun 14, 2018 1:28 pm

I've never heard of such a feature. Although I might not be understanding your meaning.

The one who saved first would only lose their work, if the 2nd person who edits, removes the work that the first one performed. Not unless one of them saved a new file. What if the first one saved the file under a different name? Then their edits would not be showing in the file which still has the original name.

In any case, there's no way to lock a file that I know of. But if you have control of the server, you could probably password protect a directory, or something like that.

Well there is a way to lock objects and to lock layers. But anyone could unlock them, so they aren't necessarily secure.

Edit
Or maybe the missing work is on a hidden layer?

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Lock file to prevent simultaneous edits

Postby Lazur » Thu Jun 14, 2018 3:56 pm

Archicad creates an .lck file once you open a document, which then triggers the program to give an option to open the file with executive access or not by the second person to prevent saving over.

Inkscape never had that feature as far as I know.
All I can think is trying to use symbols, which may help linking outside data from two or more designers so you wouldn't cross eachother's work. However that won't prevent any edits happening when opening the master file simultanously.

neex101
Posts: 2
Joined: Wed Jun 13, 2018 9:30 pm

Re: Lock file to prevent simultaneous edits

Postby neex101 » Thu Jun 14, 2018 7:33 pm

OK, thanks guys.

Yes, it's a technique commonly used in other areas (CAD, Office etc). When the file is open, a second "~$..." file is created (usually hidden) which prevents anyone else from opening it (hence lock file). When the file is closed, the lock file is removed (so the file can be opened again).

Surprised it's not in. Any other workarounds I wonder?

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: Lock file to prevent simultaneous edits

Postby Xav » Thu Jun 14, 2018 10:21 pm

It's commonly used in applications where there's an anticipation of sharing files from a common server for multiple people to work on, but Inkscape isn't really built with that mindset. It's more of a single-user desktop application. As for workarounds:

1) Get your users into the habit of copying the file from the server to their local machines, editing from there, then copying the file back. It won't prevent the problem, but at least the user that loses out will still have a copy of their work on their local machine.

2) Get your users into the habit of always saving as a new version. This can be as simple as appending a sequential letter or number to the filename. This way the whole history of the file is preserved, users are less likely to overwrite each others work, and it may be more obvious when there's an issue (i.e. I opened file_A.svg, but when I go to save it, there's already a file_B.svg on the server).

3) Go the whole hog and use some version control software. This is a more technical solution which is usually used by developers writing code, but it also works for other types of file. In this case users check out a copy of the file(s) from the server, work on them locally, then commit their changes back. The server keeps track of all the historical versions, and you can retrieve those whenever you need to. If the user tries to commit when their copy is out of date (because someone else has committed in the meantime), they'll get told about it and given the chance to merge their changes with the one on the server (this works better for a plain text document, such as source code - not so well for an XML document). Some systems can also implement file locks, but this is less common with the modern style of "distributed" version control systems, where it is anticipated that users can all work on the same files and just merge them when needed.


Unless you're already using version control software for other reasons, I recommend (2) (perhaps combined with (1) for good measure), as it's fairly simple to implement, but does require users to get into the habit.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

User avatar
shawnhcorey
Posts: 149
Joined: Mon Jan 07, 2008 12:17 pm

Re: Lock file to prevent simultaneous edits

Postby shawnhcorey » Thu Jun 14, 2018 11:38 pm

neex101 wrote:Hi!

Can inkscape generate a lock file when it opens, to prevent someone else opening that file?

I need this to prevent accidental loss of work - two of our team open the same file on our server, make different edits and save. The one who saves first loses their work.

Many thanks,
Ed


Use git. Git is designed for multiple, distributed edits.

User avatar
GAngus
Posts: 83
Joined: Tue Oct 13, 2009 8:41 am
Location: NY

Re: Lock file to prevent simultaneous edits

Postby GAngus » Fri Jun 15, 2018 6:36 am

Have you considered just locking the file at the system level ?
This way, only you can unlock it, but they will only be able to save it as a copy or rename it incrementally.

In OSX (Mac user here) just find the file in your Documents folder and do a ‘get-info’ (or windows equivalent) and just check the lock box.
This way the original file can not be edited except by you.

It can still be opened by someone else and edited, BUT they can only save a copy of it or some incremental version of it.
I am sure any Windows or Linux system has an equivalent function of locking the file.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Lock file to prevent simultaneous edits

Postby Moini » Sat Jun 16, 2018 12:01 am

Or maybe you would like to make a feature request at https://bugs.launchpad.net/inkscape ? It's an interesting idea, maybe devs would like to learn about it.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

phiscribe
Posts: 15
Joined: Sun Apr 22, 2018 1:54 pm

Re: Lock file to prevent simultaneous edits

Postby phiscribe » Sat Jun 16, 2018 1:21 am

I'm on Windows. There is a utility, (the free version does enough for me,) called FileHamster. You tell it a folder or folders to watch. Anytime a file is changed or added to that folder(s), it creates a backup to a library location of your choice, renamed with a date stamp. So this is basically revision control. If you are on another OS, or on Win and don't like FileHamster, I am sure you can find something similar. This doesn't fix your lock problem, but makes it livable. It can save your rump in many other situations too.


Return to “General Discussions”