make retransmit rotor diseqc command retries changable
[enigma2.git] / lib / python / Tools / Directories.py
index 320490723bda8619ce1647ef830d77af6f580da4..adf7afd06c25198c81d2c023914cca5606a1c413 100644 (file)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 import os
 
 SCOPE_TRANSPONDERDATA = 0
@@ -42,10 +43,14 @@ fallbackPaths = {
                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 = os.path.join(path_prefix, base[2:])
 
        # don't resolve absolute paths
-       if len(base) and base[0] == '/':
+       if base[0:1] == '/':
                return base
 
        path = defaultPaths[scope]
@@ -89,6 +94,15 @@ def resolveFilename(scope, base = ""):
 def pathExists(path):
        return os.path.exists(path)
 
+def createDir(path):
+       try:
+               os.mkdir(path)
+       except:
+               ret = 0
+       else:
+               ret = 1
+       return ret
+
 def fileExists(f):
        try:
                file = open(f)
@@ -125,3 +139,5 @@ def getRecordingFilename(basename):
 def InitFallbackFiles():
        resolveFilename(SCOPE_CONFIG, "userbouquet.favourites.tv")
        resolveFilename(SCOPE_CONFIG, "bouquets.tv")
+       resolveFilename(SCOPE_CONFIG, "userbouquet.favourites.radio")
+       resolveFilename(SCOPE_CONFIG, "bouquets.radio")