Use AbsolutePathBuf::into_std_path_buf
This commit is contained in:
parent
c8dd42c0a7
commit
6c859cf68f
|
@ -1,3 +1,4 @@
|
||||||
|
use nu_path::AbsolutePathBuf;
|
||||||
use nu_protocol::{
|
use nu_protocol::{
|
||||||
engine::{EngineState, Stack},
|
engine::{EngineState, Stack},
|
||||||
Range, ShellError, Span, Value,
|
Range, ShellError, Span, Value,
|
||||||
|
@ -15,7 +16,7 @@ pub fn get_init_cwd() -> PathBuf {
|
||||||
pub fn get_guaranteed_cwd(engine_state: &EngineState, stack: &Stack) -> PathBuf {
|
pub fn get_guaranteed_cwd(engine_state: &EngineState, stack: &Stack) -> PathBuf {
|
||||||
engine_state
|
engine_state
|
||||||
.cwd(Some(stack))
|
.cwd(Some(stack))
|
||||||
.map(Into::into)
|
.map(AbsolutePathBuf::into_std_path_buf)
|
||||||
.unwrap_or(crate::util::get_init_cwd())
|
.unwrap_or(crate::util::get_init_cwd())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use nu_cmd_base::util::get_init_cwd;
|
use nu_cmd_base::util::get_init_cwd;
|
||||||
use nu_engine::command_prelude::*;
|
use nu_engine::command_prelude::*;
|
||||||
|
use nu_path::AbsolutePathBuf;
|
||||||
use nu_utils::filesystem::{have_permission, PermissionResult};
|
use nu_utils::filesystem::{have_permission, PermissionResult};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -45,7 +46,7 @@ impl Command for Cd {
|
||||||
// user can use `cd` to recover PWD to a good state.
|
// user can use `cd` to recover PWD to a good state.
|
||||||
let cwd = engine_state
|
let cwd = engine_state
|
||||||
.cwd(Some(stack))
|
.cwd(Some(stack))
|
||||||
.map(Into::into)
|
.map(AbsolutePathBuf::into_std_path_buf)
|
||||||
.unwrap_or(get_init_cwd());
|
.unwrap_or(get_init_cwd());
|
||||||
|
|
||||||
let path_val = {
|
let path_val = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user