[gnome-commander] Fix behavior when the user opens '.' directory at startup, fixing #16



commit 9ea3dd8dbca0dc0c1742f2d8a459f9c22d714555
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Oct 30 00:01:40 2021 +0200

    Fix behavior when the user opens '.' directory at startup, fixing #16

 NEWS               |  1 +
 doc/C/releases.xml |  3 +++
 src/main.cc        | 14 ++++++++++++++
 3 files changed, 18 insertions(+)
---
diff --git a/NEWS b/NEWS
index 08af6f7d..c68f2798 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ New features:
 Bug fixes:
  * Fixed issue #3  (Mounted devices pluged when Commander is running are not noticed)
  * Fixed issue #5  ("Follow Links" option does not work when copying files)
+ * Fixed issue #16 (Start-left-dir doesn't work on '.' (dot directory))
  * Fixed issue #33 (Get rid of deprecated gnome-vfs)
  * Fixed issue #52 (Auto refresh when changing permissions etc)
  * Fixed issue #75 (Newly inserted DVD does not show up)
diff --git a/doc/C/releases.xml b/doc/C/releases.xml
index 85cb10bf..1c1c57ff 100644
--- a/doc/C/releases.xml
+++ b/doc/C/releases.xml
@@ -35,6 +35,9 @@
                         <listitem>
                             <para>Fixed issue #5 ("Follow Links" option does not work when copying 
files)</para>
                         </listitem>
+                        <listitem>
+                            <para>Fixed issue #16 (Start-left-dir doesn't work on '.' (dot directory))</para>
+                        </listitem>
                         <listitem>
                             <para>Fixed issue #33 (Get rid of deprecated gnome-vfs)</para>
                         </listitem>
diff --git a/src/main.cc b/src/main.cc
index 52fabb85..48ba65ef 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -145,10 +145,24 @@ int main (int argc, char *argv[])
     {
 #endif
         if (start_dir_left)
+        {
+            if (!strcmp(start_dir_left, "."))
+            {
+                g_free(start_dir_left);
+                start_dir_left = g_get_current_dir ();
+            }
             
gnome_cmd_data.tabs[LEFT].push_back(make_pair(string(start_dir_left),make_triple(GnomeCmdFileList::COLUMN_NAME,GTK_SORT_ASCENDING,FALSE)));
+        }
 
         if (start_dir_right)
+        {
+            if (!strcmp(start_dir_right, "."))
+            {
+                g_free(start_dir_right);
+                start_dir_right = g_get_current_dir ();
+            }
             
gnome_cmd_data.tabs[RIGHT].push_back(make_pair(string(start_dir_right),make_triple(GnomeCmdFileList::COLUMN_NAME,GTK_SORT_ASCENDING,FALSE)));
+        }
 
         gcmd_user_actions.set_defaults();
         ls_colors_init ();


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