[kupfer] plugin.text: Normalize free-text matched paths



commit d10159362235e93c008b5b1866d637279081ceec
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Dec 10 21:45:03 2009 +0100

    plugin.text: Normalize free-text matched paths
    
    We must use normpath to normalize paths, since a "." path will match
    the current directory (normally home), but only the name "." will be
    used for the folder which is confusing especially for non-geeks.

 kupfer/plugin/text.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/plugin/text.py b/kupfer/plugin/text.py
index 74b94ad..d2555d8 100644
--- a/kupfer/plugin/text.py
+++ b/kupfer/plugin/text.py
@@ -37,9 +37,9 @@ class PathTextSource (TextSource):
 	def get_items(self, text):
 		# Find directories or files
 		prefix = os.path.expanduser(u"~/")
-		filepath = text if os.path.isabs(text) else os.path.join(prefix, text)
+		ufilepath = text if os.path.isabs(text) else os.path.join(prefix, text)
 		# use filesystem encoding here
-		filepath = gobject.filename_from_utf8(filepath)
+		filepath = gobject.filename_from_utf8(os.path.normpath(ufilepath))
 		if os.access(filepath, os.R_OK):
 			yield FileLeaf(filepath)
 	def provides(self):



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