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

konsolebox notifications at xxxxx
Thu Aug 18 12:33:58 UTC 2016


> all that happens IIUC is an old file is left behind, the new data is still saved at the new location and the Geany buffer points to it.

That's a big thing in my opinion.  It's counter-intuitive that the save operation would not abort if rename fails, especially that the user is wanting a "Rename" operation.  The user expects the file to be renamed and not just saved.  Geany should allow the user to decide what to do with their data if an error occurs.

> Better to save the buffer for safety, and then let the user handle the leftovers

Having an implicit safety measure with the unnecessary price of having things happen behind the scene is not a good thing.  It's better to let the user decide what to do with it.  He can still save it somewhere, either temporarily or permanently, then try to fix the issue.  We should at least give meaning to the error message that we show the user everytime a rename operation fails.

I myself would not want to feel cautious about deleting the original file and checking that that changes were actually saved in the new file everytime this happens.  I'd rather have things in control.  It's easier to fix things that way.  Manually deleting things is also an unnecessary trouble.  If a user doesn't realize right away that he has an existing old file, it could give him trouble in the future.

It's also an obvious programming choice to abort an operation (and revert changes if necessary) if a crucial step before another ends up with an error.  I'm not sure why this is even questioned.

> Also the change of document_rename_file() to return a value will need an API bump and an ABI bump. IMHO this isn't important enough to cause an ABI bump, it should be delayed until the next one happens.

Well waiting is not a bad thing, although I'm not sure if there's even a plugin out there that uses the API function.  Also, isn't an ABI bump doable to just about every release?  We can just inform the users (mostly targetting distro maintainers) through the NEWS file that an API function has slightly changed.

Since this doesn't rename any function, and since the function was originally a `void`, this change would only require a plugin to be recompiled.  No immediate change in its code would have to be added.

I checked `geany-plugins`.  Among the plugins affected that may need to be recompiled is the binder plugin `geanypy` that compiles with the `document_rename_file()` function, but it isn't necessarily the one that calls/uses it.  Recompiling the plugin is unlikely necessary unless something actually uses `Document_rename_file()`. There's also `multiterm`, but it doesn't call the wrapper function.  Recompilation is also unlikely necessary.

-- 
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-240709228
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160818/bd5e22a9/attachment.html>


More information about the Github-comments mailing list