macos: open filepath which contains spaces correctly (#1415)

main
multisn8 2 years ago committed by GitHub
commit da4b2602c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

1
Cargo.lock generated

@ -1367,6 +1367,7 @@ dependencies = [
"rmpv", "rmpv",
"serde", "serde",
"serde_json", "serde_json",
"shlex",
"skia-safe", "skia-safe",
"swash", "swash",
"tokio", "tokio",

@ -39,6 +39,7 @@ rand = "0.8.5"
rmpv = "1.0.0" rmpv = "1.0.0"
serde = { version = "1.0.136", features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79" serde_json = "1.0.79"
shlex = "1.1.0"
swash = "0.1.4" swash = "0.1.4"
tokio = { version = "1.17.0", features = ["full"] } tokio = { version = "1.17.0", features = ["full"] }
tokio-util = { version = "0.7.1", features = ["compat"] } tokio-util = { version = "0.7.1", features = ["compat"] }

@ -170,7 +170,16 @@ pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
neovim_args.push("-p".to_owned()); neovim_args.push("-p".to_owned());
} }
neovim_args.extend::<Vec<String>>(files_to_open); if cfg!(target_os = "macos") {
// escape filepath which contain spaces
neovim_args.extend(
files_to_open
.iter()
.map(|file| shlex::quote(file).into_owned()),
);
} else {
neovim_args.extend::<Vec<String>>(files_to_open);
}
/* /*
* Integrate Environment Variables as Defaults to the command-line ones. * Integrate Environment Variables as Defaults to the command-line ones.

Loading…
Cancel
Save