From bac61040639f15f2d9995d0d04836a2908f65ac4 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 5 Feb 2020 09:14:24 +0000 Subject: [PATCH] Don't error when removing home if it's not there --- files/bin/code-project-list | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/bin/code-project-list b/files/bin/code-project-list index 5a5c0b3..5b24388 100755 --- a/files/bin/code-project-list +++ b/files/bin/code-project-list @@ -34,7 +34,10 @@ def get_vscode_project_dirs(): def main(): project_paths = sorted(set(itertools.chain(get_search_project_dirs(), get_vscode_project_dirs())), key=lambda p: p.name.lower()) - project_paths.remove(Path.home()) + try: + project_paths.remove(Path.home()) # Don't try and edit home dir + except ValueError: + pass project_paths_display = [str(project.relative_to(Path.home())) for project in project_paths] selected_project = subprocess.run(["rofi", "-dmenu", "-no-case-sensitive", "-format", "i"], input="\n".join(project_paths_display).encode(), stdout=subprocess.PIPE)