[gnome-commander] Assign value to dir_path in parse_command method



commit 634284377dadbedc8cefd861e24fe24b74214a1c
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Feb 5 16:43:11 2022 +0100

    Assign value to dir_path in parse_command method

 src/gnome-cmd-user-actions.cc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 7199aacf..a4a9e9d4 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -2113,6 +2113,20 @@ int parse_command(string *cmd, const gchar *command)
     GnomeCmdFileList *fl = get_fl (ACTIVE);
     GList *sfl = fl->get_selected_files();
 
+    if (sfl)
+    {
+        auto gnomeCmdFile = (GnomeCmdFile*) sfl->data;
+        auto gFileParent = g_file_get_parent(gnomeCmdFile->gFile);
+        dir_path = g_file_get_path(gFileParent);
+        g_object_unref(gFileParent);
+    }
+    else
+    {
+        // ToDo: Fix this misleading usage of the home directory
+        dir_path = g_get_home_dir();
+    }
+
+
     cmdcap = cmd->capacity();
     cmdlen = cmd->length();
 


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