mirror of
https://github.com/beetbox/beets.git
synced 2026-02-10 09:25:42 +01:00
convert import paths to absolute; more _syspath calls
Again, patch mainly due to jonathan.buchanan.
This commit is contained in:
parent
5d79d3e537
commit
93594bac5a
4 changed files with 11 additions and 8 deletions
|
|
@ -91,7 +91,7 @@ def _sorted_walk(path):
|
|||
files = []
|
||||
for base in os.listdir(path):
|
||||
cur = os.path.join(path, base)
|
||||
if os.path.isdir(cur):
|
||||
if os.path.isdir(library._syspath(cur)):
|
||||
dirs.append(base)
|
||||
else:
|
||||
files.append(base)
|
||||
|
|
|
|||
|
|
@ -138,8 +138,8 @@ def _mkdirall(path):
|
|||
parent).
|
||||
"""
|
||||
for ancestor in _ancestry(path):
|
||||
if not os.path.isdir(ancestor):
|
||||
os.mkdir(ancestor)
|
||||
if not os.path.isdir(_syspath(ancestor)):
|
||||
os.mkdir(_syspath(ancestor))
|
||||
|
||||
def _components(path, pathmod=None):
|
||||
"""Return a list of the path components in path. For instance:
|
||||
|
|
@ -973,7 +973,7 @@ class Library(BaseLibrary):
|
|||
def remove(self, item, delete=False):
|
||||
self.conn.execute('DELETE FROM items WHERE id=?', (item.id,))
|
||||
if delete:
|
||||
os.unlink(item.path)
|
||||
os.unlink(_syspath(item.path))
|
||||
|
||||
|
||||
# Browsing.
|
||||
|
|
|
|||
|
|
@ -315,9 +315,12 @@ def read_albums(paths):
|
|||
"""A generator yielding all the albums (as sets of Items) found in
|
||||
the user-specified list of paths.
|
||||
"""
|
||||
# Use absolute paths.
|
||||
paths = [library._normpath(path) for path in paths]
|
||||
|
||||
# Check the user-specified directories.
|
||||
for path in paths:
|
||||
if not os.path.isdir(path):
|
||||
if not os.path.isdir(library._syspath(path)):
|
||||
raise ui.UserError('not a directory: ' + path)
|
||||
# Look for saved progress.
|
||||
resume_dirs = {}
|
||||
|
|
@ -486,7 +489,7 @@ def apply_choices(lib, copy, write, art, delete):
|
|||
# Finally, delete old files.
|
||||
if copy and delete:
|
||||
for old_path in old_paths:
|
||||
os.remove(old_path)
|
||||
os.remove(library._syspath(old_path))
|
||||
|
||||
# Update progress.
|
||||
progress_set(toppath, path)
|
||||
|
|
@ -513,7 +516,7 @@ def simple_import(lib, paths, copy, delete):
|
|||
|
||||
if copy and delete:
|
||||
for old_path in old_paths:
|
||||
os.remove(old_path)
|
||||
os.remove(library._syspath(old_path))
|
||||
|
||||
log.info('added album: %s - %s' % (album.artist, album.album))
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ class ArtFileTest(unittest.TestCase):
|
|||
def setUp(self):
|
||||
# Make library and item.
|
||||
self.lib = beets.library.Library(':memory:')
|
||||
self.libdir = os.path.join('rsrc', 'testlibdir')
|
||||
self.libdir = os.path.abspath(os.path.join('rsrc', 'testlibdir'))
|
||||
self.lib.directory = self.libdir
|
||||
self.i = item()
|
||||
self.i.path = self.lib.destination(self.i)
|
||||
|
|
|
|||
Loading…
Reference in a new issue