dont show pip options in extension menu when no pip is available
[enigma2.git] / lib / python / Tools / Directories.py
index 975d3ade64f1f746a8c9fc976b42771f4d14d2ea..4cdb1d4285cd626189d10a581c02983d58e4ac3a 100644 (file)
@@ -105,17 +105,17 @@ def createDir(path):
                ret = 1
        return ret
 
-def fileExists(f):
+def fileExists(f, mode='r'):
        try:
-               file = open(f)
+               file = open(f, mode)
        except IOError:
                exists = 0
        else:
                exists = 1
        return exists
 
-def getRecordingFilename(basename):
-               # filter out non-allowed characters
+def getRecordingFilename(basename, dirname = None):
+       # filter out non-allowed characters
        non_allowed_characters = "/.\\:*?<>|\""
        filename = ""
        
@@ -125,7 +125,10 @@ def getRecordingFilename(basename):
                if c in non_allowed_characters:
                        c = "_"
                filename += c
-       
+
+       if dirname is not None:
+               filename = ''.join([dirname, filename])
+
        i = 0
        while True:
                path = resolveFilename(SCOPE_HDD, filename)