mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-05-31 07:39:44 +03:00
Fix creating settings file on Linux.
This commit is contained in:
parent
5f05f7216a
commit
b96c5bc88b
@ -195,23 +195,23 @@ class Config:
|
|||||||
try:
|
try:
|
||||||
self.config.readfp(codecs.open(self.filename, 'r', 'utf-8'))
|
self.config.readfp(codecs.open(self.filename, 'r', 'utf-8'))
|
||||||
except:
|
except:
|
||||||
self.config.add_section('DEFAULT')
|
self.config.add_section('config')
|
||||||
|
|
||||||
if not self.get('outdir') or not isdir(self.get('outdir')):
|
if not self.get('outdir') or not isdir(self.get('outdir')):
|
||||||
self.set('outdir', expanduser('~'))
|
self.set('outdir', expanduser('~'))
|
||||||
|
|
||||||
def set(self, key, val):
|
def set(self, key, val):
|
||||||
self.config.set('DEFAULT', key, val)
|
self.config.set('config', key, val)
|
||||||
|
|
||||||
def get(self, key):
|
def get(self, key):
|
||||||
try:
|
try:
|
||||||
return self.config.get('DEFAULT', key) # all values are stored as strings
|
return self.config.get('config', key) # all values are stored as strings
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def getint(self, key):
|
def getint(self, key):
|
||||||
try:
|
try:
|
||||||
return int(self.config.get('DEFAULT', key)) # all values are stored as strings
|
return int(self.config.get('config', key)) # all values are stored as strings
|
||||||
except:
|
except:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user