Commit cdb549ff authored by Guillaume Seguin's avatar Guillaume Seguin

Fix #507: use local files before system wide ones

parent 7e7f2b50
...@@ -62,15 +62,14 @@ def imagefile(filename): ...@@ -62,15 +62,14 @@ def imagefile(filename):
return os.path.join("images", filename) return os.path.join("images", filename)
def lookup_file(filename, prefixes): def lookup_file(filename, prefixes):
local_candidate = os.path.join(os.path.dirname(sys.argv[0]), filename)
if os.path.exists(local_candidate):
return local_candidate
for prefix in prefixes: for prefix in prefixes:
candidate = os.path.join(prefix, filename) candidate = os.path.join(prefix, filename)
if os.path.exists(candidate): if os.path.exists(candidate):
return candidate return candidate
local_candidate = os.path.join(os.path.dirname(sys.argv[0]), filename) return filename
if os.path.exists(local_candidate):
return local_candidate
else:
return filename
def pixmapfile(filename): def pixmapfile(filename):
return lookup_file(filename, ['/usr/local/share/pixmaps', return lookup_file(filename, ['/usr/local/share/pixmaps',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment