From a06bb0878f5a7c0ebf20ceff48f278b9ae5e5e1a Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 16 Dec 2018 17:20:28 -0800 Subject: When enabling debug mode in Web, use common.build_data_dir() to get data dir path --- onionshare/web/web.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/onionshare/web/web.py b/onionshare/web/web.py index 21e9cd8f..0f156941 100644 --- a/onionshare/web/web.py +++ b/onionshare/web/web.py @@ -184,19 +184,7 @@ class Web(object): """ Turn on debugging mode, which will log flask errors to a debug file. """ - if self.common.platform == 'Windows': - try: - appdata = os.environ['APPDATA'] - flask_debug_filename = '{}\\OnionShare\\flask_debug.log'.format(appdata) - except: - # If for some reason we don't have the 'APPDATA' environment variable - # (like running tests in Linux while pretending to be in Windows) - flask_debug_filename = os.path.expanduser('~/.config/onionshare/flask_debug.log') - elif self.common.platform == 'Darwin': - flask_debug_filename = os.path.expanduser('~/Library/Application Support/OnionShare/flask_debug.log') - else: - flask_debug_filename = os.path.expanduser('~/.config/onionshare/flask_debug.log') - + flask_debug_filename = os.path.join(self.common.build_data_dir(), 'flask_debug.log') log_handler = logging.FileHandler(flask_debug_filename) log_handler.setLevel(logging.WARNING) self.app.logger.addHandler(log_handler) -- cgit v1.2.3-54-g00ecf