-def resolveFilename(scope, base = ""):
- print "getting scope", scope, "with base", base
- path = defaultPaths[scope]
- print "path:", path
-
- if not fileExists(path[0] + 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 base[0:1] == '/':
+ return base
+
+ if scope == SCOPE_CURRENT_SKIN:
+ from Components.config import config
+ tmp = defaultPaths[SCOPE_SKIN]
+ pos = config.skin.primary_skin.value.rfind('/')
+ if pos != -1:
+ path = tmp[0]+config.skin.primary_skin.value[:pos+1]
+ else:
+ path = tmp[0]
+ else:
+ tmp = defaultPaths[scope]
+ path = tmp[0]
+
+ flags = tmp[1]
+
+ if flags == PATH_CREATE:
+ if (not pathExists(path)):
+ mkdir(path)
+
+ #if len(base) > 0 and base[0] == '/':
+ #path = ("", None)
+
+ if not fileExists(path + base):