[Xfce4-commits] [apps/catfish] 03/03: Fix startpath user expansion (--path=~/Desktop)

noreply at xfce.org noreply at xfce.org
Thu Dec 19 11:45:10 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/catfish.

commit 6ed6b427422f5d0433ba58a86c1775c770aa80fd
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Thu Dec 19 05:44:04 2019 -0500

    Fix startpath user expansion (--path=~/Desktop)
---
 catfish/CatfishWindow.py | 33 ++++++++++++++---------
 po/catfish.pot           | 68 ++++++++++++++++++++++++------------------------
 2 files changed, 55 insertions(+), 46 deletions(-)

diff --git a/catfish/CatfishWindow.py b/catfish/CatfishWindow.py
index c98c4be..f2d103a 100644
--- a/catfish/CatfishWindow.py
+++ b/catfish/CatfishWindow.py
@@ -504,6 +504,15 @@ class CatfishWindow(Window):
 
         return False
 
+    def get_path(self, arg):
+        realpath = os.path.realpath(arg)
+        if os.path.isdir(realpath):
+            return realpath
+        realpath = os.path.realpath(os.path.expanduser(arg))
+        if os.path.isdir(realpath):
+            return realpath
+        return None
+
     def parse_path_option(self, options, args):
         # Set the selected folder path. Allow legacy --path option.
         path = None
@@ -511,23 +520,23 @@ class CatfishWindow(Window):
         # New format, first argument
         if self.options.path is None:
             if len(args) > 0:
-                if os.path.isdir(os.path.realpath(args[0])):
-                    path = args.pop(0)
+                path = self.get_path(args[0])
+                if path:
+                    args.pop(0)
 
         # Old format, --path
         else:
-            if os.path.isdir(os.path.realpath(self.options.path)):
-                path = self.options.path
+            path = self.get_path(self.options.path)
 
-        # Make sure there is a valid path.
+        # Try the user home directory
         if path is None:
-            path = os.path.expanduser("~")
-            if os.path.isdir(os.path.realpath(path)):
-                return path
-            else:
-                return "/"
-        else:
-            return path
+            path = self.get_path("~")
+
+        # Once all options are exhausted, return the root
+        if path is None:
+            path = "/"
+
+        return path
 
     def parse_options(self, options, args):
         """Parse commandline arguments into Catfish runtime settings."""
diff --git a/po/catfish.pot b/po/catfish.pot
index ca5b8f0..e5e789f 100644
--- a/po/catfish.pot
+++ b/po/catfish.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-11-15 16:49-0500\n"
+"POT-Creation-Date: 2019-12-19 05:42-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -18,7 +18,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 
 #: ../org.xfce.Catfish.desktop.in.h:1 ../data/ui/CatfishWindow.ui.h:28
-#: ../catfish/CatfishWindow.py:722
+#: ../catfish/CatfishWindow.py:731
 msgid "Catfish File Search"
 msgstr ""
 
@@ -213,11 +213,11 @@ msgstr ""
 msgid "File Type"
 msgstr ""
 
-#: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1281
+#: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1290
 msgid "Modified"
 msgstr ""
 
-#: ../data/ui/CatfishWindow.ui.h:29 ../catfish/CatfishWindow.py:1731
+#: ../data/ui/CatfishWindow.ui.h:29 ../catfish/CatfishWindow.py:1740
 msgid "Results will be displayed as soon as they are found."
 msgstr ""
 
@@ -365,140 +365,140 @@ msgid ""
 "or click the %s icon for more options."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:690
+#: ../catfish/CatfishWindow.py:699
 msgid "An error occurred while updating the database."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:692
+#: ../catfish/CatfishWindow.py:701
 msgid "Authentication failed."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:698
+#: ../catfish/CatfishWindow.py:707
 msgid "Authentication cancelled."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:704
+#: ../catfish/CatfishWindow.py:713
 msgid "Search database updated successfully."
 msgstr ""
 
 #. Set the dialog status to running.
-#: ../catfish/CatfishWindow.py:779
+#: ../catfish/CatfishWindow.py:788
 msgid "Updating..."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:813
+#: ../catfish/CatfishWindow.py:822
 msgid "Stop Search"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:814
+#: ../catfish/CatfishWindow.py:823
 msgid ""
 "Search is in progress...\n"
 "Press the cancel button or the Escape key to stop."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:823
+#: ../catfish/CatfishWindow.py:832
 msgid "Begin Search"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1101
+#: ../catfish/CatfishWindow.py:1110
 #, python-format
 msgid "\"%s\" could not be opened."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1153
+#: ../catfish/CatfishWindow.py:1162
 #, python-format
 msgid "\"%s\" could not be saved."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1170
+#: ../catfish/CatfishWindow.py:1179
 #, python-format
 msgid "\"%s\" could not be deleted."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1210
+#: ../catfish/CatfishWindow.py:1219
 #, python-format
 msgid "Save \"%s\" as..."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1245
+#: ../catfish/CatfishWindow.py:1254
 #, python-format
 msgid ""
 "Are you sure that you want to \n"
 "permanently delete \"%s\"?"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1249
+#: ../catfish/CatfishWindow.py:1258
 #, python-format
 msgid ""
 "Are you sure that you want to \n"
 "permanently delete the %i selected files?"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1252
+#: ../catfish/CatfishWindow.py:1261
 msgid "If you delete a file, it is permanently lost."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1275
+#: ../catfish/CatfishWindow.py:1284
 msgid "Filename"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1277
+#: ../catfish/CatfishWindow.py:1286
 msgid "Size"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1279
+#: ../catfish/CatfishWindow.py:1288
 msgid "Location"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1291
+#: ../catfish/CatfishWindow.py:1300
 msgid "Preview"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1299
+#: ../catfish/CatfishWindow.py:1308
 msgid "Details"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1518
+#: ../catfish/CatfishWindow.py:1527
 msgid "Today"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1520
+#: ../catfish/CatfishWindow.py:1529
 msgid "Yesterday"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1601
+#: ../catfish/CatfishWindow.py:1610
 msgid "No files found."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1603
+#: ../catfish/CatfishWindow.py:1612
 msgid ""
 "Try making your search less specific\n"
 "or try another directory."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1610
+#: ../catfish/CatfishWindow.py:1619
 msgid "1 file found."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1612
+#: ../catfish/CatfishWindow.py:1621
 #, python-format
 msgid "%i files found."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1618
+#: ../catfish/CatfishWindow.py:1627
 msgid "bytes"
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1729 ../catfish/CatfishWindow.py:1739
+#: ../catfish/CatfishWindow.py:1738 ../catfish/CatfishWindow.py:1748
 msgid "Searching..."
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1737
+#: ../catfish/CatfishWindow.py:1746
 #, python-format
 msgid "Searching for \"%s\""
 msgstr ""
 
-#: ../catfish/CatfishWindow.py:1826
+#: ../catfish/CatfishWindow.py:1835
 #, python-format
 msgid "Search results for \"%s\""
 msgstr ""

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list