[gnome-commander/gcmd-1-12] build_search_command: exclude current folder from search result explicitly



commit 00b44a6dd8515ec80f6b5a8f8c5f1aa7166d41df
Author: Mamoru TASAKA <mtasaka fedoraproject org>
Date:   Fri Apr 9 00:47:10 2021 +0900

    build_search_command: exclude current folder from search result explicitly
    
    In "Search" mode, when search result list contains the current directory itself,
    FileFormatData::FileFormatData() behaves badly because fl->priv->base_dir gets
    longer than dpath.
    
    Anyway as "Search" mode GUI says "Look in folder:", it is guessable that the folder
    itself is not included in the result. Explicitly exlude the folder in
    SearchData::build_search_command().
    
    Use g_string_append for "static" string

 src/dialogs/gnome-cmd-search-dialog.cc | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/src/dialogs/gnome-cmd-search-dialog.cc b/src/dialogs/gnome-cmd-search-dialog.cc
index 17a0e338..f85d1ecd 100644
--- a/src/dialogs/gnome-cmd-search-dialog.cc
+++ b/src/dialogs/gnome-cmd-search-dialog.cc
@@ -636,6 +636,7 @@ gchar *SearchData::build_search_command()
     g_string_append (command, "find ");
     g_string_append (command, look_in_folder_quoted);
 
+    g_string_append (command, " -mindepth 1"); // exclude the directory itself
     if (dialog->defaults.default_profile.max_depth!=-1)
         g_string_append_printf (command, " -maxdepth %i", dialog->defaults.default_profile.max_depth+1);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]