[Geany-devel] [geany/geany] 7cc443: Don't append file truncation warning if file doesn't exist - incorrect for remote files

Lex Trotman elextr at xxxxx
Thu Jan 26 22:32:22 UTC 2012


On Fri, Jan 27, 2012 at 2:42 AM, Nick Treleaven <git-noreply at geany.org> wrote:
> Branch:      refs/heads/master
> Author:      Nick Treleaven <nick.treleaven at btinternet.com>
> Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
> Date:        Thu, 26 Jan 2012 15:42:06
> Commit:      7cc443e1420b77d041815a464fe5b20bc62412f4
>             https://github.com/geany/geany/commit/7cc443e1420b77d041815a464fe5b20bc62412f4
>
> Log Message:
> -----------
> Don't append file truncation warning if file doesn't exist
>
> This warning shown after a failed save is unnecessary when the
> filename is invalid.
>
>
> Modified Paths:
> --------------
>    src/document.c
>
> Modified: src/document.c
> 3 files changed, 2 insertions(+), 1 deletions(-)
> ===================================================================
> @@ -1766,7 +1766,8 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
>        {
>                ui_set_statusbar(TRUE, _("Error saving file (%s)."), errmsg);
>
> -               if (!file_prefs.use_safe_file_saving)
> +               if (!file_prefs.use_safe_file_saving &&
> +                       g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR))

Hi Nick,

If writing a remote file failed half way because of a network failure,
then if the network is still faulty when we g_file_test for a regular
file, it will fail because the file doesn't exist, but the partly
written file may (is likely to) be truncated.

Cheers
Lex

>                {
>                        SETPTR(errmsg,
>                                g_strdup_printf(_("%s\n\nThe file on disk may now be truncated!"), errmsg));
>
>
>
> --------------
> This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
> _______________________________________________
> Geany-commits mailing list
> Geany-commits at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-commits



More information about the Devel mailing list