[Geany-devel] Improve catching of project write failure

Colomban Wendling lists.ban at xxxxx
Fri Jan 14 16:11:35 UTC 2011


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).

I fixed this (in the attached patch) by:

1) check whether the path is not a directory, because
utils_is_file_writeable() [1] returns TRUE in this case, but write will
still fail. Perhaps it should rather be fixed in utils_is_file_writeable()?

2) check the return value of write_config(). This needed a little more
tuning for later calls to update_config() to work correctly, but now if
write actually fails, and even if update_config() reported no error, an
error will be displayed to the user and she will have a chance to retry.

There is a last write_config() that may file silently though, the one in
project_close(); not sure how this may be fixed.


Best regards,
Colomban

[1] shouldn't it be renamed utils_is_file_writable(), without the "e"?
Not sure though, but it looks weird to me and my spellchecker complains
about it...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Improve-catching-of-project-write-failure.patch
Type: text/x-patch
Size: 3878 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20110114/9ca53f77/attachment.bin>


More information about the Devel mailing list