Clean up read_file().
This commit is contained in:
parent
2780793bf4
commit
302736925b
@ -31,5 +31,9 @@ Subpackages:
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os.path
|
||||
|
||||
__version_info__ = (0, 0, 0)
|
||||
__version__ = '.'.join(map(str, __version_info__))
|
||||
|
||||
basedir = os.path.dirname(os.path.realpath(__file__))
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user