mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 23:11:14 -03:00
Fix to prevent autosuggesting cd'ing to the current working directory
This commit is contained in:
12
path.cpp
12
path.cpp
@@ -529,6 +529,18 @@ bool path_is_valid(const wcstring &path, const wcstring &working_directory)
|
||||
return path_is_valid;
|
||||
}
|
||||
|
||||
bool paths_are_same_file(const wcstring &path1, const wcstring &path2) {
|
||||
if (path1 == path2)
|
||||
return true;
|
||||
|
||||
struct stat s1, s2;
|
||||
if (wstat(path1.c_str(), &s1) == 0 && wstat(path2.c_str(), &s2) == 0) {
|
||||
return s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
wcstring get_working_directory(void) {
|
||||
wcstring wd = L"./";
|
||||
wchar_t dir_path[4096];
|
||||
|
||||
Reference in New Issue
Block a user