pty: fallback to ~ or / when creating new term if current dir is not available
Closes T5186
This commit is contained in:
parent
74c1ceffd8
commit
e188244c72
|
@ -575,14 +575,34 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
|||
if (!ty->pid)
|
||||
{
|
||||
char buf[256];
|
||||
int ret;
|
||||
|
||||
if (cd)
|
||||
{
|
||||
if (chdir(cd) != 0)
|
||||
ret = chdir(cd);
|
||||
if (ret != 0)
|
||||
{
|
||||
ERR(_("Could not change current directory to '%s': %s"),
|
||||
cd, strerror(errno));
|
||||
exit(127);
|
||||
cd = getenv("HOME");
|
||||
if (cd)
|
||||
{
|
||||
ret = chdir(cd);
|
||||
if (ret != 0)
|
||||
{
|
||||
ERR(_("Could not change current directory to '%s': %s"),
|
||||
cd, strerror(errno));
|
||||
}
|
||||
}
|
||||
if (ret != 0)
|
||||
{
|
||||
cd = "/";
|
||||
if (chdir(cd) != 0)
|
||||
{
|
||||
ERR(_("Could not change current directory to '%s': %s"),
|
||||
cd, strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue