On Sat, 26 Apr 2008 13:45:19 +0200, FD Cami francois.cami@free.fr wrote:
On Sat, 26 Apr 2008 13:34:49 +0200 FD Cami francois.cami@free.fr wrote:
On Fri, 25 Apr 2008 15:12:17 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
yesterday an user reported that Geany behaves badly when there is no free disk space on the disk where the current file should be saved. That is, when you are editing a file in Geany, meanwhile your disk runs out of free space (extensive logging, copying large files, some process gone bad, ...) and you then save the file in Geany, it gets overwritten and the file is emptied. This is indeed bad. And there seems to be no easy way to fix it.
The only solution which comes to my mind would be to check for available disk space before trying to write the file. Unfortunately, there seems to be no portable way of doing this.
This does not work everytime, as far as I know there still could be a minute chance of another process writing stuff and filling up the disk before geany manages to write the file to disk.
It may be that one way to do it is :
- move "file" to "file~"
- save memory buffer to "file"
- remove "file~"
Since this does not scale very well for big files, there should be some on/off option in preferences.
Well, this has no real effect in comparison to the current code. The only addition are the move from "file" to "file~" and then the deletion of "file~". Both operations doesn't work on the content of the file. Anyway, I don't like the "file~" stuff very much.
I am going to work on that, unless a better idea comes up.
I'm not sure whether this is necessary. Wait a few days, I recently written a "backupcopy" plugin which copies the current file to a given directory after it was saved. So, this has basically the same effect as the the left "file~" in case of an error. But instead of the (IMO) ugly "~" extension, the extension can be configured, e.g. to contain a timestamp. I guess using the backupcopy plugin is probably enough to solve the problem together with a dialog box reporting the problem to the user (as Jeff suggested). And as I told before, when the system of the user is running out of disk space there are most probably bigger problems than the changes in the current file in Geany.
Regards, Enrico