mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-28 17:51:15 -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:
15
path.cpp
15
path.cpp
@@ -446,18 +446,3 @@ bool paths_are_same_file(const wcstring &path1, const wcstring &path2)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
wcstring get_working_directory(void)
|
||||
{
|
||||
wcstring wd = L"./";
|
||||
wchar_t dir_path[4096];
|
||||
const wchar_t *cwd = wgetcwd(dir_path, 4096);
|
||||
if (cwd)
|
||||
{
|
||||
wd = cwd;
|
||||
/* Make sure the working directory ends with a slash */
|
||||
if (! wd.empty() && wd.at(wd.size() - 1) != L'/')
|
||||
wd.push_back(L'/');
|
||||
}
|
||||
return wd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user