diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 2890576fd..aae14ee63 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -222,7 +222,7 @@ def sorted_walk(path, ignore=(), ignore_hidden=False, logger=None): for res in sorted_walk(cur, ignore, ignore_hidden, logger): yield res -def pathlib_as_posix(path): +def path_as_posix(path): """Return the string representation of the path with forward (/) slashes. """ diff --git a/beetsplug/playlist.py b/beetsplug/playlist.py index 3b8ca94c9..302ddb56d 100644 --- a/beetsplug/playlist.py +++ b/beetsplug/playlist.py @@ -18,7 +18,7 @@ import os import fnmatch import tempfile import beets -from beets.util import pathlib_as_posix +from beets.util import path_as_posix class PlaylistQuery(beets.dbcore.Query): @@ -163,7 +163,7 @@ class PlaylistPlugin(beets.plugins.BeetsPlugin): new_path = self.changes[beets.util.normpath(lookup)] except KeyError: if self.config['forward_slash']: - line = pathlib_as_posix(line) + line = path_as_posix(line) tempfp.write(line) else: if new_path is None: @@ -176,7 +176,7 @@ class PlaylistPlugin(beets.plugins.BeetsPlugin): new_path = os.path.relpath(new_path, base_dir) line = line.replace(original_path, new_path) if self.config['forward_slash']: - line = pathlib_as_posix(line) + line = path_as_posix(line) tempfp.write(line) if changes or deletions: diff --git a/beetsplug/smartplaylist.py b/beetsplug/smartplaylist.py index 757879770..4ffdd21e7 100644 --- a/beetsplug/smartplaylist.py +++ b/beetsplug/smartplaylist.py @@ -21,7 +21,7 @@ from __future__ import division, absolute_import, print_function from beets.plugins import BeetsPlugin from beets import ui from beets.util import (mkdirall, normpath, sanitize_path, syspath, - bytestring_path, pathlib_as_posix) + bytestring_path, path_as_posix) from beets.library import Item, Album, parse_query_string from beets.dbcore import OrQuery from beets.dbcore.query import MultipleSort, ParsingError @@ -208,7 +208,7 @@ class SmartPlaylistPlugin(BeetsPlugin): with open(syspath(m3u_path), 'wb') as f: for path in m3us[m3u]: if self.config['forward_slash'].get(): - path = pathlib_as_posix(path) + path = path_as_posix(path) f.write(path + b'\n') self._log.info(u"{0} playlists updated", len(self._matched_playlists)) diff --git a/test/test_files.py b/test/test_files.py index 969026b0f..6a6fa3531 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -198,7 +198,7 @@ class HelperTest(_common.TestCase): def test_forward_slash(self): p = r'C:\a\b\c' a = r'C:/a/b/c' - self.assertEqual(util.pathlib_as_posix(p), a) + self.assertEqual(util.path_as_posix(p), a) class AlbumFileTest(_common.TestCase):