target-specific file manager

This commit is contained in:
Max Bradbury 2020-10-03 13:17:20 +01:00
parent 183f1064ec
commit b281f8af00
1 changed files with 11 additions and 1 deletions

View File

@ -12,6 +12,16 @@ use std::process::Command;
const SPACING: i32 = 16;
#[cfg(target_os = "windows")]
fn file_manager() -> &'static str {
"explorer"
}
#[cfg(not(target_os = "windows"))]
fn file_manager() -> &'static str {
"xdg-open"
}
fn error_popup(message: &str) {
let popup = gtk::Window::new(gtk::WindowType::Toplevel);
popup.set_title("error");
@ -135,7 +145,7 @@ fn build_ui(application: &gtk::Application) {
let button_manage_sounds = gtk::Button::with_label("manage sounds");
button_manage_sounds.connect_clicked(|_| {
let mut file_manager = Command::new("xdg-open");
let mut file_manager = Command::new(file_manager());
file_manager.arg(get_data_dir());
file_manager.output().unwrap();
});