Fix issues with files not being in home dir

This commit is contained in:
Jake Howard 2020-04-23 20:03:10 +01:00
parent 6892873b1b
commit a2d8ae96b9
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -6,12 +6,14 @@ import itertools
import subprocess import subprocess
from io import StringIO 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 = [ SEARCH_DIRS = [
Path.home().joinpath("Projects"), HOME.joinpath("Projects"),
Path.home().joinpath("Repositories"), HOME.joinpath("Repositories"),
Path.home().joinpath("SR"), HOME.joinpath("SR"),
] ]
@ -41,7 +43,8 @@ def main():
project_paths.remove(Path.home()) # Don't try and edit home dir project_paths.remove(Path.home()) # Don't try and edit home dir
except ValueError: except ValueError:
pass 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 = subprocess.run(["rofi", "-dmenu", "-no-case-sensitive", "-format", "i"], input="\n".join(project_paths_display).encode(), stdout=subprocess.PIPE)
selected_project.check_returncode() selected_project.check_returncode()