[Geany-devel] Improve catching of project write failure

Dimitar Zhekov dimitar.zhekov at xxxxx
Fri Jan 14 17:30:35 UTC 2011


On Fri, 14 Jan 2011 17:11:35 +0100
Colomban Wendling <lists.ban at herbesfolles.org> wrote:

> Hi guys!
> 
> I found a bug in project creation (and save) check: if the project path
> is a writable directory, update_config() won't see that write will fail,
> and no error at all will be reported to the user (though write will fail
> on a directory).

While checking the hidden preferences usage, I found that a save
error for anything except document will most likely generate only a
geany_debug() message, which is useless with my setup. After some
consideration, I think the following general approach should be
implemented:

write_data_to_disk() is moved to utils.c as public gboolean function;
it displays any save error with a popup message (the code from
document_save_file).

utils_write_file() checks filename and text, invokes write_data_to_disk
and returns ENOSPACE on failure (for compatibility).

This way the saving will be unified, so GIO, gio_unsafe_save_backup,
the full POSIX-error checks and any future improvements will work for
all files, not documents only, and the save errors will always be
clearly displayed.

-- 
E-gards: Jimmy



More information about the Devel mailing list