Skip to content

Commit

Permalink
Always convert path to unicode. Fixes beetbox#1485.
Browse files Browse the repository at this point in the history
  • Loading branch information
glogiotatidis committed Jun 1, 2015
1 parent 1c3a053 commit ed3fa95
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions beets/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,6 @@ def syspath(path, prefix=True):
prefix on Windows, set `prefix` to False---but only do this if you
*really* know what you're doing.
"""
# Don't do anything if we're not on windows
if os.path.__name__ != b'ntpath':
return path

if not isinstance(path, unicode):
# Beets currently represents Windows paths internally with UTF-8
# arbitrarily. But earlier versions used MBCS because it is
Expand All @@ -375,6 +371,10 @@ def syspath(path, prefix=True):
encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
path = path.decode(encoding, 'replace')

# Don't do anything more if we're not on windows
if os.path.__name__ != b'ntpath':
return path

# Add the magic prefix if it isn't already there.
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx
if prefix and not path.startswith(WINDOWS_MAGIC_PREFIX):
Expand Down

0 comments on commit ed3fa95

Please sign in to comment.