Byron / open-rs

Open a path or URL with the system-defined program
http://byron.github.io/open-rs
MIT License
319 stars 49 forks source link

how to show file in finder/explorer? #87

Closed thep0y closed 9 months ago

thep0y commented 9 months ago

Is there any API that does the same thing as the code below?

// Windows
Command::new("explorer")
        .args(["/select,", "\"path\\to\\file""]) // The comma after select is not a typo
        .spawn()
        .unwrap();
// Alternatively there is a win32 api for this iirc which needs to be used for longer file paths i think.

// macOS
Command::new( "open" )
        .args(["-R", "path/to/file"]) // i don't have a mac so not 100% sure
        .spawn()
        .unwrap();