From 2db730f7697ed60113ce69302276cac620b79e64 Mon Sep 17 00:00:00 2001 From: Matt Rose Date: Thu, 14 May 2020 15:39:50 -0400 Subject: [PATCH] fix FileNotFound error when terminator is run from a directory that no longer exists --- terminatorlib/cwd.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/terminatorlib/cwd.py b/terminatorlib/cwd.py index f8fcb175..1f578186 100644 --- a/terminatorlib/cwd.py +++ b/terminatorlib/cwd.py @@ -25,12 +25,11 @@ except (ImportError): def get_default_cwd(): """Determine a reasonable default cwd""" - cwd = os.getcwd() - if not os.path.exists(cwd) or not os.path.isdir(cwd): - try: - cwd = pwd.getpwuid(os.getuid())[5] - except KeyError: - cwd = '/' + try: + cwd = os.getcwd() + except (FileNotFoundError,OSError): + err("unable to set current working directory, does not exist") + cwd = '/' return(cwd)