[gnome-commander] Detect path through GFile URI to decide if parent dir file is needed



commit 4ec91c23a74e5dc01458e78432b9817a950f5712
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Fri Jan 21 23:48:57 2022 +0100

    Detect path through GFile URI to decide if parent dir file is needed

 src/gnome-cmd-file-list.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 63aecdf2..da6b6dc3 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2021,10 +2021,18 @@ void GnomeCmdFileList::show_files(GnomeCmdDir *dir)
     }
 
     // Create a parent dir file (..) if appropriate
-    gchar *path = GNOME_CMD_FILE (dir)->GetPathStringThroughParent();
+    GError *error = nullptr;
+    auto uriString = GNOME_CMD_FILE (dir)->get_uri_str();
+    auto gUri = g_uri_parse(uriString, G_URI_FLAGS_NONE, &error);
+    if (error)
+    {
+        g_warning("show_files: g_uri_parse error of %s: %s", uriString, error->message);
+        g_error_free(error);
+    }
+    auto path = g_uri_get_path(gUri);
     if (path && strcmp (path, G_DIR_SEPARATOR_S) != 0)
         files = g_list_append (files, gnome_cmd_dir_new_parent_dir_file (dir));
-    g_free (path);
+    g_free (uriString);
 
     if (!files)
         return;


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