Fix build on master

imgbot
Blaž Hrastnik 4 years ago
parent fd1ae35051
commit 7511110d82

@ -1365,17 +1365,17 @@ mod cmd {
.set_status(cx.editor.clipboard_provider.name().into()); .set_status(cx.editor.clipboard_provider.name().into());
} }
fn change_current_directory(editor: &mut Editor, args: &[&str], _: PromptEvent) { fn change_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) {
let dir = match args.first() { let dir = match args.first() {
Some(dir) => dir, Some(dir) => dir,
None => { None => {
editor.set_error("target directory not provided".into()); cx.editor.set_error("target directory not provided".into());
return; return;
} }
}; };
if let Err(e) = std::env::set_current_dir(dir) { if let Err(e) = std::env::set_current_dir(dir) {
editor.set_error(format!( cx.editor.set_error(format!(
"Couldn't change the current working directory: {:?}", "Couldn't change the current working directory: {:?}",
e e
)); ));
@ -1383,20 +1383,24 @@ mod cmd {
} }
match std::env::current_dir() { match std::env::current_dir() {
Ok(cwd) => editor.set_status(format!( Ok(cwd) => cx.editor.set_status(format!(
"Current working directory is now {}", "Current working directory is now {}",
cwd.display() cwd.display()
)), )),
Err(e) => editor.set_error(format!("Couldn't get the new working directory: {}", e)), Err(e) => cx
.editor
.set_error(format!("Couldn't get the new working directory: {}", e)),
} }
} }
fn show_current_directory(editor: &mut Editor, args: &[&str], _: PromptEvent) { fn show_current_directory(cx: &mut compositor::Context, args: &[&str], _: PromptEvent) {
match std::env::current_dir() { match std::env::current_dir() {
Ok(cwd) => editor.set_status(format!("Current working directory is {}", cwd.display())), Ok(cwd) => cx
Err(e) => { .editor
editor.set_error(format!("Couldn't get the current working directory: {}", e)) .set_status(format!("Current working directory is {}", cwd.display())),
} Err(e) => cx
.editor
.set_error(format!("Couldn't get the current working directory: {}", e)),
} }
} }

Loading…
Cancel
Save