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,5 +1,6 @@
use nu_cmd_base::util::get_init_cwd;
use nu_engine::command_prelude::*;
use nu_path::AbsolutePathBuf;
use nu_utils::filesystem::{have_permission, PermissionResult};
#[derive(Clone)]
@ -43,7 +44,10 @@ impl Command for Cd {
// If getting PWD failed, default to the initial directory. This way, the
// user can use `cd` to recover PWD to a good state.
let cwd = engine_state.cwd(Some(stack)).unwrap_or(get_init_cwd());
let cwd = engine_state
.cwd(Some(stack))
.map(AbsolutePathBuf::into_std_path_buf)
.unwrap_or(get_init_cwd());
let path_val = {
if let Some(path) = path_val {