diff options
Diffstat (limited to 'src/fr-window.c')
-rw-r--r-- | src/fr-window.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/fr-window.c b/src/fr-window.c index fb5da06..cec29a2 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -3289,6 +3289,9 @@ action_performed (FrArchive *archive, /* -- selections -- */ +#undef DEBUG_GET_DIR_LIST_FROM_PATH + + static GList * get_dir_list_from_path (FrWindow *window, char *path) @@ -3305,9 +3308,31 @@ get_dir_list_from_path (FrWindow *window, dirname_l = strlen (dirname); for (i = 0; i < window->archive->command->files->len; i++) { FileData *fd = g_ptr_array_index (window->archive->command->files, i); + gboolean matches = FALSE; - if (strncmp (dirname, fd->full_path, dirname_l) == 0) +#ifdef DEBUG_GET_DIR_LIST_FROM_PATH + g_print ("%s <=> %s (%d)\n", dirname, fd->full_path, dirname_l); +#endif + + if (fd->dir) { + int full_path_l = strlen (fd->full_path); + if ((full_path_l == dirname_l - 1) && (strncmp (dirname, fd->full_path, full_path_l) == 0)) + /* example: dirname is '/path/to/dir/' and fd->full_path is '/path/to/dir' */ + matches = TRUE; + else if (strcmp (dirname, fd->full_path) == 0) + matches = TRUE; + } + + if (! matches && strncmp (dirname, fd->full_path, dirname_l) == 0) { + matches = TRUE; + } + + if (matches) { +#ifdef DEBUG_GET_DIR_LIST_FROM_PATH + g_print ("`-> OK\n"); +#endif list = g_list_prepend (list, g_strdup (fd->original_path)); + } } g_free (dirname); |