mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-31 23:28:45 +00:00
Use path_apply_working_directory
Using getcwd is naughty here because we want to separate these things in future.
This commit is contained in:
parent
e87ad48f9b
commit
b9bd0ce3a3
1 changed files with 4 additions and 1 deletions
|
@ -14,6 +14,8 @@
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
#include "../fallback.h" // IWYU pragma: keep
|
#include "../fallback.h" // IWYU pragma: keep
|
||||||
#include "../io.h"
|
#include "../io.h"
|
||||||
|
#include "../parser.h"
|
||||||
|
#include "../path.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
#include "../wcstringutil.h"
|
#include "../wcstringutil.h"
|
||||||
#include "../wgetopt.h"
|
#include "../wgetopt.h"
|
||||||
|
@ -676,7 +678,8 @@ static int path_resolve(parser_t &parser, io_streams_t &streams, int argc, const
|
||||||
wcstring next = *arg;
|
wcstring next = *arg;
|
||||||
// First add $PWD if we're relative
|
// First add $PWD if we're relative
|
||||||
if (!next.empty() && next[0] != L'/') {
|
if (!next.empty() && next[0] != L'/') {
|
||||||
next = wgetcwd() + L"/" + next;
|
// Note pwd can have symlinks, but we are about to resolve it anyway.
|
||||||
|
next = path_apply_working_directory(*arg, parser.vars().get_pwd_slash());
|
||||||
}
|
}
|
||||||
auto rest = wbasename(next);
|
auto rest = wbasename(next);
|
||||||
while(!next.empty() && next != L"/") {
|
while(!next.empty() && next != L"/") {
|
||||||
|
|
Loading…
Reference in a new issue