mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 08:11:15 -03:00
Revert "wrealpath: Fail for file/something"
Apparently macOS realpath is broken.
This reverts commit ca1c499069.
This commit is contained in:
@@ -414,9 +414,9 @@ maybe_t<wcstring> wrealpath(const wcstring &pathname) {
|
||||
// If there is no "/", this is a file in $PWD, so give the realpath to that.
|
||||
narrow_res = realpath(".", tmpbuf);
|
||||
} else {
|
||||
// Be sure to include the last "/" to have the penultimate component considered a directory.
|
||||
// Otherwise "file/something" succeeds.
|
||||
narrow_res = realpath(narrow_path.substr(0, pathsep_idx + 1).c_str(), tmpbuf);
|
||||
errno = 0;
|
||||
// Only call realpath() on the portion up to the last component.
|
||||
narrow_res = realpath(narrow_path.substr(0, pathsep_idx).c_str(), tmpbuf);
|
||||
}
|
||||
|
||||
if (!narrow_res) return none();
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
builtin realpath: /this/better/be/an/invalid/path: No such file or directory
|
||||
builtin realpath: .: No such file or directory
|
||||
builtin realpath: realpath.out/..: Not a directory
|
||||
|
||||
@@ -80,7 +80,4 @@ else
|
||||
echo "unexpected pwd-resolved-to-itself failure: $real_path != $PWD" >&2
|
||||
end
|
||||
|
||||
# Confirm that the penultimate component still needs to be a directory:
|
||||
builtin realpath realpath.out/..
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user