support path_prefix
authorFelix Domke <tmbinc@elitedvb.net>
Thu, 15 Jun 2006 17:35:05 +0000 (17:35 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Thu, 15 Jun 2006 17:35:05 +0000 (17:35 +0000)
lib/python/Tools/Directories.py

index 320490723bda8619ce1647ef830d77af6f580da4..7c50bd9fa2d2ed41828e2fb59b6555787ea0416d 100644 (file)
@@ -42,10 +42,14 @@ fallbackPaths = {
                SCOPE_HDD: [("/hdd/movies", PATH_MOVE)]
        }
 
                SCOPE_HDD: [("/hdd/movies", PATH_MOVE)]
        }
 
-def resolveFilename(scope, base = ""):
+def resolveFilename(scope, base = "", path_prefix = None):
+       if base[0:2] == "~/":
+               # you can only use the ~/ if we have a prefix directory
+               assert path_prefix is not None
+               base = path_prefix + base[2:]
 
        # don't resolve absolute paths
 
        # don't resolve absolute paths
-       if len(base) and base[0] == '/':
+       if base[0:1] == '/':
                return base
 
        path = defaultPaths[scope]
                return base
 
        path = defaultPaths[scope]