Simplify readability logic using get defaults

:D
This commit is contained in:
Jay Kamat 2018-02-18 14:49:09 -05:00
parent c844023077
commit 84907d5a2e
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -13,12 +13,10 @@
from __future__ import absolute_import
import codecs, os
if 'QUTE_DATA_DIR' in os.environ:
tmpfile = os.path.join(os.environ['QUTE_DATA_DIR'],
'userscripts/readability.html')
else:
tmpfile = os.path.expanduser(
'~/.local/share/qutebrowser/userscripts/readability.html')
tmpfile = os.path.join(
os.environ.get('QUTE_DATA_DIR',
os.path.expanduser('~/.local/share/qutebrowser')),
'userscripts/readability.html')
if not os.path.exists(os.path.dirname(tmpfile)):
os.makedirs(os.path.dirname(tmpfile))