Mercurial > geeqie
changeset 955:ffbc9195f47f
Optimize tests even more using last changes.
author | zas_ |
---|---|
date | Mon, 28 Jul 2008 18:07:42 +0000 |
parents | ed0fc0986928 |
children | d7cb8d5714d1 |
files | src/filedata.c |
diffstat | 1 files changed, 31 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filedata.c Mon Jul 28 18:02:10 2008 +0000 +++ b/src/filedata.c Mon Jul 28 18:07:42 2008 +0000 @@ -1597,23 +1597,28 @@ { gboolean same; gchar *dest_dir; - const gchar *dest_ext = extension_from_path(fd->change->dest); - if (!dest_ext) dest_ext = ""; - + same = (strcmp(fd->path, fd->change->dest) == 0); - if (strcasecmp(fd->extension, dest_ext) != 0) + if (!same) { - ret |= CHANGE_WARN_CHANGED_EXT; - DEBUG_1("Change checked: source and destination have different extensions: %s -> %s", fd->path, fd->change->dest); - } + const gchar *dest_ext = extension_from_path(fd->change->dest); + if (!dest_ext) dest_ext = ""; - if (fd->change->type != FILEDATA_CHANGE_UNSPECIFIED && /* FIXME this is now needed for running editors */ - same) + if (strcasecmp(fd->extension, dest_ext) != 0) + { + ret |= CHANGE_WARN_CHANGED_EXT; + DEBUG_1("Change checked: source and destination have different extensions: %s -> %s", fd->path, fd->change->dest); + } + } + else { - ret |= CHANGE_WARN_SAME; - DEBUG_1("Change checked: source and destination are the same: %s -> %s", fd->path, fd->change->dest); - } + if (fd->change->type != FILEDATA_CHANGE_UNSPECIFIED) /* FIXME this is now needed for running editors */ + { + ret |= CHANGE_WARN_SAME; + DEBUG_1("Change checked: source and destination are the same: %s -> %s", fd->path, fd->change->dest); + } + } dest_dir = remove_level_from_path(fd->change->dest); @@ -1627,24 +1632,27 @@ ret |= CHANGE_NO_WRITE_PERM_DEST_DIR; DEBUG_1("Change checked: destination dir is readonly: %s -> %s", fd->path, fd->change->dest); } - else if (isfile(fd->change->dest) && !same) + else if (!same) { - if (!access_file(fd->change->dest, W_OK)) + if (isfile(fd->change->dest)) { - ret |= CHANGE_NO_WRITE_PERM_DEST; - DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest); + if (!access_file(fd->change->dest, W_OK)) + { + ret |= CHANGE_NO_WRITE_PERM_DEST; + DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest); + } + else + { + ret |= CHANGE_WARN_DEST_EXISTS; + DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest); + } } - else + else if (isdir(fd->change->dest)) { - ret |= CHANGE_WARN_DEST_EXISTS; + ret |= CHANGE_DEST_EXISTS; DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest); } } - else if (isdir(fd->change->dest) && !same) - { - ret |= CHANGE_DEST_EXISTS; - DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest); - } g_free(dest_dir); }