Use settings datadir again. fix #518
This commit is contained in:
@@ -37,10 +37,9 @@ class Loader(object):
|
||||
# Create data dir if needed
|
||||
if self.options.data_dir:
|
||||
self.data_dir = self.options.data_dir
|
||||
|
||||
else:
|
||||
self.data_dir = os.path.expanduser(Env.setting('data_dir'))
|
||||
|
||||
|
||||
if self.data_dir == '':
|
||||
self.data_dir = getDataDir()
|
||||
|
||||
|
||||
@@ -20,14 +20,12 @@ import warnings
|
||||
|
||||
def getOptions(base_path, args):
|
||||
|
||||
data_dir = getDataDir()
|
||||
|
||||
# Options
|
||||
parser = ArgumentParser(prog = 'CouchPotato.py')
|
||||
parser.add_argument('--config_file', default = os.path.join(data_dir, 'settings.conf'),
|
||||
dest = 'config_file', help = 'Absolute or ~/ path of the settings file (default ./_data/settings.conf)')
|
||||
parser.add_argument('--data_dir', default = data_dir,
|
||||
parser.add_argument('--data_dir',
|
||||
dest = 'data_dir', help = 'Absolute or ~/ path of the data dir')
|
||||
parser.add_argument('--config_file',
|
||||
dest = 'config_file', help = 'Absolute or ~/ path of the settings file (default DATA_DIR/settings.conf)')
|
||||
parser.add_argument('--debug', action = 'store_true',
|
||||
dest = 'debug', help = 'Debug mode')
|
||||
parser.add_argument('--console_log', action = 'store_true',
|
||||
@@ -36,12 +34,21 @@ def getOptions(base_path, args):
|
||||
dest = 'quiet', help = 'No console logging')
|
||||
parser.add_argument('--daemon', action = 'store_true',
|
||||
dest = 'daemon', help = 'Daemonize the app')
|
||||
parser.add_argument('--pid_file', default = os.path.join(data_dir, 'couchpotato.pid'),
|
||||
parser.add_argument('--pid_file',
|
||||
dest = 'pid_file', help = 'Path to pidfile needed for daemon')
|
||||
|
||||
options = parser.parse_args(args)
|
||||
|
||||
data_dir = os.path.expanduser(options.data_dir if options.data_dir else getDataDir())
|
||||
|
||||
if not options.config_file:
|
||||
options.config_file = os.path.join(data_dir, 'settings.conf')
|
||||
|
||||
if not options.pid_file:
|
||||
options.pid_file = os.path.join(data_dir, 'couchpotato.pid')
|
||||
|
||||
options.config_file = os.path.expanduser(options.config_file)
|
||||
options.pid_file = os.path.expanduser(options.pid_file)
|
||||
|
||||
return options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user