mirror of
https://github.com/Syncplay/syncplay
synced 2025-02-03 12:41:44 +00:00
Make default config name OS specific in Getter
This commit is contained in:
parent
e1933972d6
commit
8597b826b3
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user