Path migration 1 (#13309)

# Description
Part 1 of replacing `std::path` types with `nu_path` types added in
#13115.
This commit is contained in:
Ian Manske
2024-07-09 09:25:23 +00:00
committed by GitHub
parent 399a7c8836
commit e98b2ceb8c
11 changed files with 51 additions and 54 deletions

View File

@ -1,6 +1,6 @@
#[allow(deprecated)]
use crate::{current_dir, get_config, get_full_help};
use nu_path::expand_path_with;
use nu_path::{expand_path_with, AbsolutePathBuf};
use nu_protocol::{
ast::{
Assignment, Block, Call, Expr, Expression, ExternalArgument, PathMember, PipelineElement,
@ -679,7 +679,10 @@ impl Eval for EvalRuntime {
} else if quoted {
Ok(Value::string(path, span))
} else {
let cwd = engine_state.cwd(Some(stack)).unwrap_or_default();
let cwd = engine_state
.cwd(Some(stack))
.map(AbsolutePathBuf::into_std_path_buf)
.unwrap_or_default();
let path = expand_path_with(path, cwd, true);
Ok(Value::string(path.to_string_lossy(), span))