mirror of
https://github.com/powerline/powerline.git
synced 2025-07-25 23:05:32 +02:00
Decode bytes before using os.path.join
Otherwise it will raise TypeError when trying to join str() and bytes() instance in python-3.3. Fixes #654 Closes #655
This commit is contained in:
parent
b856fa5a82
commit
ba45a002dc
@ -1,6 +1,9 @@
|
|||||||
# vim:fileencoding=utf-8:noet
|
# vim:fileencoding=utf-8:noet
|
||||||
|
|
||||||
|
from __future__ import (unicode_literals, absolute_import, print_function)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from powerline.lib.vcs import get_branch_name as _get_branch_name, get_file_status
|
from powerline.lib.vcs import get_branch_name as _get_branch_name, get_file_status
|
||||||
@ -26,7 +29,7 @@ def git_directory(directory):
|
|||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
raw = f.read().partition(b':')[2].strip()
|
raw = f.read().partition(b':')[2].strip()
|
||||||
return os.path.abspath(os.path.join(directory, raw))
|
return os.path.abspath(os.path.join(directory, raw.decode(sys.getfilesystemencoding() or 'utf-8')))
|
||||||
else:
|
else:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user