[Github-comments] [geany/geany] Make document_rename_file() return a gboolean; Abort save if rename fails (#1180)

konsolebox notifications at xxxxx
Fri Aug 19 08:06:03 UTC 2016


> The reason that the save should go ahead is because the operation being performed is "Save As". The rename function is only a secondary convenience function to save deleting the original file.

But there are no other ways to implement a rename operation on the file, because in the end you want to have the "document-save" signal to be put in one place.  So renaming a file is much just like saving.  I actually tried to separate `Rename` from `Save As` but I just ended with that problem.  `Rename` in the context of Geany is a save operation, but with a necessary step that it first has to rename the source file.

> And if you have "safe" or "GIO" file saving set the sequence is "rename original file, write new data to a new file, rename it over the just renamed original file" :-P

I find that unnecessary overkill.  There are even more issues that you'd end up with that, and some errors to consider, and what to do when they happen like how you'd abort or how you'd revert changes (the temporary file).  That also wouldn't guarantee that the file is actually renamed.  If a filesystem or OS requires that a filename be not touched when some other processes are using it, then you might end up saving to the original file but not being able to rename it.  To put it simply, that's a lot more complicated and is more prone to more issues.

> The "Save As" dialog should offer to "Remove original file after saving".

Not a bad idea.  Just rename the "R_ename" button to "Save and R_emove Original", or something else, because it would be less convenient if we remove the button and use a CheckBox.  It's actually more correct that way since it's technically in the context of "saving".

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1180#issuecomment-240954951
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160819/9a654bcc/attachment.html>


More information about the Github-comments mailing list