Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/python/Tools/Directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,20 @@
scopeFonts = defaultPaths[SCOPE_FONTS][0]
scopePlugins = defaultPaths[SCOPE_PLUGINS][0]

cachedSkinFilenames = {} # Dictionary of skin filenames already resolved.

def InitDefaultPaths():
resolveFilename(SCOPE_CONFIG)


def resolveFilename(scope, base="", path_prefix=None):
cached_filename_key = ""
if scope == SCOPE_GUISKIN:
cached_filename_key = str(path_prefix) + ":" + str(base)
cached_filename = cachedSkinFilenames.get(cached_filename_key)
if cached_filename is not None:
return cached_filename

if str(base).startswith("~%s" % sep): # You can only use the ~/ if we have a prefix directory.
if path_prefix:
base = pathjoin(path_prefix, base[2:])
Expand Down Expand Up @@ -216,6 +224,8 @@ def itemExists(resolveList, base):
path = path[len(plugins) + 1:]
if suffix is not None: # If a suffix was supplier restore it.
path = "%s:%s" % (path, suffix)
if scope == SCOPE_GUISKIN:
cachedSkinFilenames[cached_filename_key] = path
return path


Expand Down