Browse Source

Use path of executable for resolving data directory. Don't assume . is it.

283
Amir Taaki 13 years ago
parent
commit
0cf581b64a
  1. 7
      lib/gui_lite.py

7
lib/gui_lite.py

@ -37,8 +37,11 @@ def resize_line_edit_width(line_edit, text_input):
line_edit.setMinimumWidth(metrics.width(text_input)) line_edit.setMinimumWidth(metrics.width(text_input))
def cd_data_dir(): def cd_data_dir():
if os.path.exists(os.path.join("data", "style.css")): assert sys.argv
data_dir = os.path.join(".", "data") 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: else:
data_dir = appdata_dir() data_dir = appdata_dir()
QDir.setCurrent(data_dir) QDir.setCurrent(data_dir)

Loading…
Cancel
Save