mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-23 21:31:14 -03:00
Rely on $PWD instead of getcwd() more often
Fixes https://github.com/fish-shell/fish-shell/issues/696
This commit is contained in:
14
env.cpp
14
env.cpp
@@ -507,6 +507,20 @@ int env_set_pwd()
|
||||
return 1;
|
||||
}
|
||||
|
||||
wcstring env_get_pwd_slash(void)
|
||||
{
|
||||
env_var_t pwd = env_get_string(L"PWD");
|
||||
if (pwd.missing_or_empty())
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
if (! string_suffixes_string(L"/", pwd))
|
||||
{
|
||||
pwd.push_back(L'/');
|
||||
}
|
||||
return pwd;
|
||||
}
|
||||
|
||||
/**
|
||||
Set up default values for various variables if not defined.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user