[feat] basic open path but having issue of path with spaces
This commit is contained in:
@@ -15,6 +15,7 @@ pub fn run_steam() -> std::io::Result<std::process::Output> {
|
||||
.output()
|
||||
}
|
||||
|
||||
// FIXME wmic is deprecated
|
||||
pub fn get_exe_path(name: &str) -> Result<String, std::io::Error> {
|
||||
let command = format!("/C wmic process where name='{}' get ExecutablePath", name);
|
||||
let args = command.split_whitespace().collect::<Vec<&str>>();
|
||||
@@ -33,3 +34,12 @@ pub fn get_exe_path(name: &str) -> Result<String, std::io::Error> {
|
||||
"Failed to get executable path",
|
||||
))
|
||||
}
|
||||
|
||||
pub fn open_path(path: &str) -> Result<(), std::io::Error> {
|
||||
let p = format!("file:///{}", path);
|
||||
Command::new("explorer")
|
||||
.args([p])
|
||||
.spawn()
|
||||
.expect("Failed to open path");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user