From 8c38292abd179f7e1566fcebb36163429d30a3b0 Mon Sep 17 00:00:00 2001 From: Michael Sabin Date: Sat, 22 Sep 2018 02:48:02 -0700 Subject: [PATCH] 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. --- supysonic/managers/folder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supysonic/managers/folder.py b/supysonic/managers/folder.py index 3670333..c92985e 100644 --- a/supysonic/managers/folder.py +++ b/supysonic/managers/folder.py @@ -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)):