target-specific file manager
This commit is contained in:
parent
183f1064ec
commit
b281f8af00
12
src/main.rs
12
src/main.rs
|
@ -12,6 +12,16 @@ use std::process::Command;
|
||||||
|
|
||||||
const SPACING: i32 = 16;
|
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) {
|
fn error_popup(message: &str) {
|
||||||
let popup = gtk::Window::new(gtk::WindowType::Toplevel);
|
let popup = gtk::Window::new(gtk::WindowType::Toplevel);
|
||||||
popup.set_title("error");
|
popup.set_title("error");
|
||||||
|
@ -135,7 +145,7 @@ fn build_ui(application: >k::Application) {
|
||||||
let button_manage_sounds = gtk::Button::with_label("manage sounds");
|
let button_manage_sounds = gtk::Button::with_label("manage sounds");
|
||||||
|
|
||||||
button_manage_sounds.connect_clicked(|_| {
|
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.arg(get_data_dir());
|
||||||
file_manager.output().unwrap();
|
file_manager.output().unwrap();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue