1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-09 19:52:16 +00:00

Merge pull request #118 from m35/expand-path

Expand path when adding a folder
This commit is contained in:
Alban 2018-09-30 17:36:20 +02:00 committed by GitHub
commit 608bea1152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,9 +33,9 @@ class FolderManager:
if Folder.get(name = name, root = True) is not None:
raise ValueError("Folder '{}' exists".format(name))
path = os.path.abspath(path)
path = os.path.abspath(os.path.expanduser(path))
if not os.path.isdir(path):
raise ValueError("The path doesn't exits or is'nt a directory")
raise ValueError("The path doesn't exits or isn't a directory")
if Folder.get(path = path) is not None:
raise ValueError('This path is already registered')
if any(path.startswith(p) for p in select(f.path for f in Folder if f.root)):