mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-10 04:02:17 +00:00
Expand path when adding a folder
Expand the path using the system environment before generating the absolute path. For example, ~ was not being expanded to the user's home directory.
This commit is contained in:
parent
b654f969f5
commit
8c38292abd
@ -33,9 +33,9 @@ class FolderManager:
|
|||||||
if Folder.get(name = name, root = True) is not None:
|
if Folder.get(name = name, root = True) is not None:
|
||||||
raise ValueError("Folder '{}' exists".format(name))
|
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):
|
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:
|
if Folder.get(path = path) is not None:
|
||||||
raise ValueError('This path is already registered')
|
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)):
|
if any(path.startswith(p) for p in select(f.path for f in Folder if f.root)):
|
||||||
|
Loading…
Reference in New Issue
Block a user