commit 0cf581b64aa26c82fd72fcc9efb09eddd8a1b985
parent 0b0a6f3657718f757b9ae677a1812f2a56e3505a
Author: Amir Taaki <genjix@riseup.net>
Date: Tue, 10 Jul 2012 17:49:40 +0100
Use path of executable for resolving data directory. Don't assume . is it.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/gui_lite.py b/lib/gui_lite.py
@@ -37,8 +37,11 @@ def resize_line_edit_width(line_edit, text_input):
line_edit.setMinimumWidth(metrics.width(text_input))
def cd_data_dir():
- if os.path.exists(os.path.join("data", "style.css")):
- data_dir = os.path.join(".", "data")
+ assert sys.argv
+ prefix_path = os.path.dirname(sys.argv[0])
+ local_data = os.path.join(prefix_path, "data")
+ if os.path.exists(os.path.join(local_data, "style.css")):
+ data_dir = local_data
else:
data_dir = appdata_dir()
QDir.setCurrent(data_dir)