Modify read_file to use pkg_utils
This commit is contained in:
parent
f596864324
commit
2a7062c5c8
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
from pkg_resources import resource_string
|
||||||
|
|
||||||
import qutebrowser
|
import qutebrowser
|
||||||
|
|
||||||
@ -32,9 +33,7 @@ def read_file(filename):
|
|||||||
Return:
|
Return:
|
||||||
The file contents as string.
|
The file contents as string.
|
||||||
"""
|
"""
|
||||||
fn = os.path.join(qutebrowser.basedir, filename)
|
return resource_string(qutebrowser.__name__, filename).decode('UTF-8')
|
||||||
with open(fn, 'r', encoding='UTF-8') as f:
|
|
||||||
return f.read()
|
|
||||||
|
|
||||||
|
|
||||||
def dotted_getattr(obj, path):
|
def dotted_getattr(obj, path):
|
||||||
|
Loading…
Reference in New Issue
Block a user