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
Lock file to prevent simultaneous edits
Re: Lock file to prevent simultaneous edits
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?
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?
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Lock file to prevent simultaneous edits
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.
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.
Re: Lock file to prevent simultaneous edits
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?
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?
Re: Lock file to prevent simultaneous edits
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.
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.
- shawnhcorey
- Posts: 149
- Joined: Mon Jan 07, 2008 12:17 pm
Re: Lock file to prevent simultaneous edits
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.
Re: Lock file to prevent simultaneous edits
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.
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.
Re: Lock file to prevent simultaneous edits
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)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: Lock file to prevent simultaneous edits
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.