From a2d8ae96b9dba0557596cf870e1a770b6ac213e8 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 23 Apr 2020 20:03:10 +0100 Subject: [PATCH] Fix issues with files not being in home dir --- files/bin/vscode-project-list | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/files/bin/vscode-project-list b/files/bin/vscode-project-list index 0a2953f..5a88999 100755 --- a/files/bin/vscode-project-list +++ b/files/bin/vscode-project-list @@ -6,12 +6,14 @@ import itertools import subprocess from io import StringIO -VSCODE_CONFIG_FILE = Path.home().joinpath(".config/Code/storage.json") +HOME = Path.home() + +VSCODE_CONFIG_FILE = HOME.joinpath(".config/Code/storage.json") SEARCH_DIRS = [ - Path.home().joinpath("Projects"), - Path.home().joinpath("Repositories"), - Path.home().joinpath("SR"), + HOME.joinpath("Projects"), + HOME.joinpath("Repositories"), + HOME.joinpath("SR"), ] @@ -41,7 +43,8 @@ def main(): 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] + home_dir = str(HOME) + "/" + project_paths_display = [str(project).replace(home_dir, "") 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) selected_project.check_returncode()