commit 15a8e1167bbfcdd9f989138cda05622c463115ed parent e954bdef3efbf9f0dc5709d9403b2d341cb8b9e8 Author: Amir Taaki <genjix@riseup.net> Date: Thu, 5 Jul 2012 01:25:05 +0200 get_resource_path("foo.png") -> "/usr/share/electrum/foo.png" Diffstat:
A | util.py | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/util.py b/util.py @@ -0,0 +1,17 @@ +import os +import platform +import sys + +def appdata_dir(): + if platform.system() == "Windows": + return os.path.join(os.environ["APPDATA"], "Electrum") + elif platform.system() == "Linux": + return os.path.join(sys.prefix, "share", "electrum") + elif platform.system() == "Darwin": + return "/Library/Application Support/Electrum" + else: + raise Exception("Unknown system") + +def get_resource_path(filename): + return os.path.join(appdata_dir(), filename) +