fix FileNotFound error when terminator is run from a directory that no longer exists
This commit is contained in:
parent
51cf811561
commit
2db730f769
|
@ -25,12 +25,11 @@ except (ImportError):
|
||||||
|
|
||||||
def get_default_cwd():
|
def get_default_cwd():
|
||||||
"""Determine a reasonable default cwd"""
|
"""Determine a reasonable default cwd"""
|
||||||
cwd = os.getcwd()
|
try:
|
||||||
if not os.path.exists(cwd) or not os.path.isdir(cwd):
|
cwd = os.getcwd()
|
||||||
try:
|
except (FileNotFoundError,OSError):
|
||||||
cwd = pwd.getpwuid(os.getuid())[5]
|
err("unable to set current working directory, does not exist")
|
||||||
except KeyError:
|
cwd = '/'
|
||||||
cwd = '/'
|
|
||||||
|
|
||||||
return(cwd)
|
return(cwd)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue