[gnome-commander/gcmd-1-14] Fix for legacy mounting a device: do not stop if no GMount is available



commit 2d5186e548ad40955d83e4ce6514b1bca2061383
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sun May 1 12:14:21 2022 +0200

    Fix for legacy mounting a device: do not stop if no GMount is available

 src/gnome-cmd-con-device.cc | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/src/gnome-cmd-con-device.cc b/src/gnome-cmd-con-device.cc
index 9e838c47..006e7470 100644
--- a/src/gnome-cmd-con-device.cc
+++ b/src/gnome-cmd-con-device.cc
@@ -201,7 +201,16 @@ static void do_legacy_mount_thread_func(GnomeCmdCon *con)
     GError *error = nullptr;
 
     if (!con->base_path)
-        con->base_path = new GnomeCmdPlainPath(G_DIR_SEPARATOR_S);
+    {
+        if (GNOME_CMD_CON_DEVICE(con)->priv->mountp)
+        {
+            con->base_path = new GnomeCmdPlainPath(GNOME_CMD_CON_DEVICE(con)->priv->mountp);
+        }
+        else
+        {
+            con->base_path = new GnomeCmdPlainPath(G_DIR_SEPARATOR_S);
+        }
+    }
 
     do_legacy_mount(con);
 
@@ -394,17 +403,25 @@ static GFile *dev_create_gfile (GnomeCmdCon *con, GnomeCmdPath *gnomeCmdPath)
     GFile *newGFile = nullptr;
     GnomeCmdConDevice *dev_con = GNOME_CMD_CON_DEVICE (con);
 
-    g_return_val_if_fail (dev_con->priv->gMount != nullptr, nullptr);
-
-    if (gnomeCmdPath)
+    if (dev_con->priv->gMount != nullptr)
     {
-        auto gMountGFile = g_mount_get_default_location (dev_con->priv->gMount);
-        newGFile = g_file_get_child (gMountGFile, gnomeCmdPath->get_path());
-        g_object_unref(gMountGFile);
+        if (gnomeCmdPath)
+        {
+            auto gMountGFile = g_mount_get_default_location (dev_con->priv->gMount);
+            newGFile = g_file_resolve_relative_path(gMountGFile, gnomeCmdPath->get_path());
+            g_object_unref(gMountGFile);
+        }
+        else
+        {
+            newGFile = g_mount_get_default_location (dev_con->priv->gMount);
+        }
     }
     else
     {
-        newGFile = g_mount_get_default_location (dev_con->priv->gMount);
+        if (gnomeCmdPath != nullptr)
+        {
+            newGFile = g_file_new_for_path(gnomeCmdPath->get_path());
+        }
     }
     return newGFile;
 }


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