Rely on $PWD instead of getcwd() more often

Fixes https://github.com/fish-shell/fish-shell/issues/696
This commit is contained in:
ridiculousfish
2013-04-27 00:45:38 -07:00
parent 807c5f2ef2
commit fe6699f0bf
7 changed files with 22 additions and 30 deletions

View File

@@ -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;
}