From 8597b826b3bd704cc665d9a01b3dc38347c3003c Mon Sep 17 00:00:00 2001 From: Etoh Date: Fri, 21 Feb 2014 11:39:03 +0000 Subject: [PATCH] Make default config name OS specific in Getter --- syncplay/ui/ConfigurationGetter.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/syncplay/ui/ConfigurationGetter.py b/syncplay/ui/ConfigurationGetter.py index ffd683e..c553f58 100644 --- a/syncplay/ui/ConfigurationGetter.py +++ b/syncplay/ui/ConfigurationGetter.py @@ -144,20 +144,26 @@ class ConfigurationGetter(object): def _checkForPortableFile(self): path = utils.findWorkingDir() - for name in constants.DEFAULT_CONFIG_NAMES: + for name in constants.CONFIG_NAMES: if(os.path.isfile(os.path.join(path, name))): return os.path.join(path, name) def _getConfigurationFilePath(self): configFile = self._checkForPortableFile() if not configFile: - for name in constants.DEFAULT_CONFIG_NAMES: + for name in constants.CONFIG_NAMES: if(configFile and os.path.isfile(configFile)): break if(os.name <> 'nt'): configFile = os.path.join(os.getenv('HOME', '.'), name) else: configFile = os.path.join(os.getenv('APPDATA', '.'), name) + if(configFile and not os.path.isfile(configFile)): + if(os.name <> 'nt'): + configFile = os.path.join(os.getenv('HOME', '.'), constants.DEFAULT_CONFIG_NAME_LINUX) + else: + configFile = os.path.join(os.getenv('APPDATA', '.'), constants.DEFAULT_CONFIG_NAME_WINDOWS) + return configFile def _parseConfigFile(self, iniPath, createConfig = True): @@ -246,7 +252,7 @@ class ConfigurationGetter(object): def _loadRelativeConfiguration(self): locations = self.__getRelativeConfigLocations() for location in locations: - for name in constants.DEFAULT_CONFIG_NAMES: + for name in constants.CONFIG_NAMES: path = location + os.path.sep + name self._parseConfigFile(path, createConfig = False) self._checkConfig()