fix logfile for deluge

This commit is contained in:
Marcos Pinto 2008-07-20 04:40:22 +00:00
parent f52ebbe541
commit 4ebba67fa4
1 changed files with 10 additions and 8 deletions

View File

@ -59,16 +59,18 @@ def start_ui():
# Get the options and args from the OptionParser
(options, args) = parser.parse_args()
if deluge.common.windows_check():
if options.config:
if not os.path.exists(options.config):
os.makedirs(options.config)
else:
if not os.path.exists(deluge.common.get_default_config_dir()):
os.makedirs(deluge.common.get_default_config_dir())
if options.logfile:
if options.config:
if not os.path.exists(options.config):
os.makedirs(options.config)
logfile = os.path.join(options.config, "deluge.log")
logfile = os.path.join(options.config, options.logfile)
else:
if not os.path.exists(deluge.common.get_default_config_dir()):
os.makedirs(deluge.common.get_default_config_dir())
logfile = deluge.common.get_default_config_dir("deluge.log")
config_dir = deluge.common.get_default_config_dir()
logfile = os.path.join(config_dir, options.logfile)
sys.stdout = open(logfile, "wb")
sys.stderr = sys.stdout
sys.stdin = None