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 # Get the options and args from the OptionParser
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if deluge.common.windows_check():
if options.config: if options.config:
if not os.path.exists(options.config): if not os.path.exists(options.config):
os.makedirs(options.config) os.makedirs(options.config)
logfile = os.path.join(options.config, "deluge.log")
else: else:
if not os.path.exists(deluge.common.get_default_config_dir()): if not os.path.exists(deluge.common.get_default_config_dir()):
os.makedirs(deluge.common.get_default_config_dir()) os.makedirs(deluge.common.get_default_config_dir())
logfile = deluge.common.get_default_config_dir("deluge.log") if options.logfile:
if options.config:
logfile = os.path.join(options.config, options.logfile)
else:
config_dir = deluge.common.get_default_config_dir()
logfile = os.path.join(config_dir, options.logfile)
sys.stdout = open(logfile, "wb") sys.stdout = open(logfile, "wb")
sys.stderr = sys.stdout sys.stderr = sys.stdout
sys.stdin = None sys.stdin = None