diff --git a/qutebrowser/__init__.py b/qutebrowser/__init__.py index ab8cbc22e..73c64cca7 100644 --- a/qutebrowser/__init__.py +++ b/qutebrowser/__init__.py @@ -31,5 +31,9 @@ Subpackages: # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . +import os.path + __version_info__ = (0, 0, 0) __version__ = '.'.join(map(str, __version_info__)) + +basedir = os.path.dirname(os.path.realpath(__file__)) diff --git a/qutebrowser/utils/misc.py b/qutebrowser/utils/misc.py index 948dfe4f0..86c1efc76 100644 --- a/qutebrowser/utils/misc.py +++ b/qutebrowser/utils/misc.py @@ -27,6 +27,8 @@ try: except ImportError: from pdb import set_trace as pdb_set_trace +import qutebrowser + def set_trace(): """ @@ -45,8 +47,6 @@ def set_trace(): def read_file(filename): """Return the contents of a file contained with qutebrowser.""" - fn = os.path.join(os.path.dirname(os.path.realpath(__file__)), - os.path.pardir, filename) - with open(fn, 'r') as f: - # FIXME is there a nicer way? - return '\n'.join(f.readlines()) + fn = os.path.join(qutebrowser.basedir, filename) + with open(fn, 'r', encoding='UTF-8') as f: + return f.read()