"Unable to save file" when I do not have a file creation rights and "Back Up Before Saving" is enabled


#1

When I am editing an existing file in a directory in which I do not have a file creation right everything is fine. I can save the modified file (with write access) without problems as expected.

Once I enable Back Up Before Saving1 in Atom settings then the file saving in such a case always fails with an error message like:

Unable to save file
’…/local/bin/publdirlink~’

Atom always tries to create the backup file in the same directory as the file about to be saved. Of course this fails when I do not have the right to create a new file there. I think it would be very useful if Atom creates the backup file in a temporary directory instead in such cases.


1 I want to have backups enabled because I want to minimize the risk of losing the content of my file during saving in various conditions.
2 I have shortened the backup file path in the error message.


#2

There really isn’t a right answer for all cases on this. We took a look at a lot of options in how to handle this (see #3158 for the history) and, for now, this is the best solution. Obviously, it isn’t the best for this particular situation … but it is what we have for now until we can come up with something better.

Just writing the backup files to the temp directory isn’t the best solution because:

  1. You can have the same problem there
  2. It is harder to find the backups
  3. You have to build a system for encoding either the directory structure or disambiguating multiple files of the same name
  4. etc