mirror of
https://github.com/beetbox/beets.git
synced 2026-02-01 04:55:38 +01:00
Merge pull request #4849 from wisp3rwind/pr_add_syspath_3
Always use syspath conversions (#3690 split up, part 3)
This commit is contained in:
commit
efebd72ca9
3 changed files with 10 additions and 7 deletions
|
|
@ -392,7 +392,8 @@ class ImportSession:
|
|||
"""Mark paths and directories as merged for future reimport tasks.
|
||||
"""
|
||||
self._merged_items.update(paths)
|
||||
dirs = {os.path.dirname(path) if os.path.isfile(path) else path
|
||||
dirs = {os.path.dirname(path)
|
||||
if os.path.isfile(syspath(path)) else path
|
||||
for path in paths}
|
||||
self._merged_dirs.update(dirs)
|
||||
|
||||
|
|
@ -921,7 +922,7 @@ class ImportTask(BaseImportTask):
|
|||
the file still exists, no pruning is performed, so it's safe to
|
||||
call when the file in question may not have been removed.
|
||||
"""
|
||||
if self.toppath and not os.path.exists(filename):
|
||||
if self.toppath and not os.path.exists(syspath(filename)):
|
||||
util.prune_dirs(os.path.dirname(filename),
|
||||
self.toppath,
|
||||
clutter=config['clutter'].as_str_seq())
|
||||
|
|
@ -1131,7 +1132,7 @@ class ArchiveImportTask(SentinelImportTask):
|
|||
if self.extracted:
|
||||
log.debug('Removing extracted directory: {0}',
|
||||
displayable_path(self.toppath))
|
||||
shutil.rmtree(self.toppath)
|
||||
shutil.rmtree(syspath(self.toppath))
|
||||
|
||||
def extract(self):
|
||||
"""Extracts the archive to a temporary directory and sets
|
||||
|
|
|
|||
|
|
@ -1215,7 +1215,7 @@ class Album(LibModel):
|
|||
if not old_art:
|
||||
return
|
||||
|
||||
if not os.path.exists(old_art):
|
||||
if not os.path.exists(syspath(old_art)):
|
||||
log.error('removing reference to missing album art file {}',
|
||||
util.displayable_path(old_art))
|
||||
self.artpath = None
|
||||
|
|
|
|||
|
|
@ -1272,7 +1272,7 @@ def update_items(lib, query, album, move, pretend, fields):
|
|||
|
||||
def update_func(lib, opts, args):
|
||||
# Verify that the library folder exists to prevent accidental wipes.
|
||||
if not os.path.isdir(lib.directory):
|
||||
if not os.path.isdir(syspath(lib.directory)):
|
||||
ui.print_("Library path is unavailable or does not exist.")
|
||||
ui.print_(lib.directory)
|
||||
if not ui.input_yn("Are you sure you want to continue (y/n)?", True):
|
||||
|
|
@ -1666,8 +1666,10 @@ def move_func(lib, opts, args):
|
|||
dest = opts.dest
|
||||
if dest is not None:
|
||||
dest = normpath(dest)
|
||||
if not os.path.isdir(dest):
|
||||
raise ui.UserError('no such directory: %s' % dest)
|
||||
if not os.path.isdir(syspath(dest)):
|
||||
raise ui.UserError('no such directory: {}'.format(
|
||||
displayable_path(dest)
|
||||
))
|
||||
|
||||
move_items(lib, dest, decargs(args), opts.copy, opts.album, opts.pretend,
|
||||
opts.timid, opts.export)
|
||||
|
|
|
|||
Loading…
Reference in a new issue