+ 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)
+
+ fallbackPath = fallbackPaths.get(scope)
+
+ if fallbackPath and not fileExists(path + base):
+ for x in fallbackPath:
+ if x[1] == FILE_COPY:
+ if fileExists(x[0] + base):
+ system("cp " + x[0] + base + " " + path + base)
+ break
+ elif x[1] == FILE_MOVE:
+ if fileExists(x[0] + base):
+ system("mv " + x[0] + base + " " + path + base)
+ break
+ elif x[1] == PATH_COPY:
+ if pathExists(x[0]):
+ if not pathExists(defaultPaths[scope][0]):
+ mkdir(path)
+ system("cp -a " + x[0] + "* " + path)
+ break
+ elif x[1] == PATH_MOVE:
+ if pathExists(x[0]):
+ system("mv " + x[0] + " " + path)
+ break
+
+ # FIXME: we also have to handle DATADIR etc. here.
+ return path + base