From 375a7fdc64c0208901530acf177d2b3469bc4c15 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 14 Oct 2007 13:42:58 +0000 Subject: [PATCH] Fix CONFIG_DIR issues on windows when ~ does not expand. --- src/common.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/common.py b/src/common.py index 9008192db..3e4f15ffd 100644 --- a/src/common.py +++ b/src/common.py @@ -44,13 +44,6 @@ def windows_check(): else: return False -if windows_check(): - CONFIG_DIR = os.path.join(os.path.expanduser("~"), 'deluge') - if not os.path.exists(CONFIG_DIR): - os.mkdir(CONFIG_DIR) -else: - CONFIG_DIR = xdg.BaseDirectory.save_config_path('deluge') - import sys if hasattr(sys, "frozen"): INSTALL_PREFIX = '' @@ -60,6 +53,16 @@ if hasattr(sys, "frozen"): else: # the necessary substitutions are made at installation time INSTALL_PREFIX = '@datadir@' + +if windows_check(): + if os.path.isdir(os.path.expanduser("~")): + CONFIG_DIR = os.path.join(os.path.expanduser("~"), 'deluge') + else: + CONFIG_DIR = os.path.join(INSTALL_PREFIX, 'deluge') + if not os.path.exists(CONFIG_DIR): + os.mkdir(CONFIG_DIR) +else: + CONFIG_DIR = xdg.BaseDirectory.save_config_path('deluge') GLADE_DIR = os.path.join(INSTALL_PREFIX, 'share', 'deluge', 'glade') PIXMAP_DIR = os.path.join(INSTALL_PREFIX, 'share', 'deluge', 'pixmaps')