Skip to content

Commit

Permalink
Try to fix Linux and Win32 build
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Jul 4, 2024
1 parent f852659 commit c2303f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
6 changes: 2 additions & 4 deletions pot-browser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ bytesize.workspace = true
camino.workspace = true
anyhow.workspace = true
url.workspace = true
opener = { version = "0.7.1", features = ["reveal"] }

[target.'cfg(target_os = "macos")'.dependencies]
rfd = "0.12.1"

[target.'cfg(any(all(target_os = "windows", target_arch = "x86_64"), target_os = "macos"))'.dependencies]
opener = { version = "0.7.1", features = ["reveal"] }
rfd = "0.12.1"
26 changes: 5 additions & 21 deletions pot-browser/src/pot_browser_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1634,9 +1634,7 @@ fn add_preset_table(mut input: PresetTableInput, ui: &mut Ui, preset_cache: &mut
if let pot::PotPresetKind::FileBased(k) = &data.preset.kind {
if ui.button("Show preset in file manager").clicked() {
if k.path.exists() {
if let Err(e) = opener::reveal(&k.path) {
process_error(&e, input.toasts);
}
reveal(&k.path);
} else {
show_error_toast(
"Preset file doesn't exist",
Expand All @@ -1648,9 +1646,7 @@ fn add_preset_table(mut input: PresetTableInput, ui: &mut Ui, preset_cache: &mut
}
if let Some(preview_file) = &data.preview_file {
if ui.button("Show preview in file manager").clicked() {
if let Err(e) = opener::reveal(preview_file) {
process_error(&e, input.toasts);
}
reveal(preview_file);
ui.close_menu();
}
}
Expand Down Expand Up @@ -3490,21 +3486,9 @@ fn open_link(thing: &str) {
}
}

fn reveal(path: &Path) {
#[cfg(any(
all(target_os = "windows", target_arch = "x86_64"),
target_os = "macos"
))]
{
if opener::reveal(path).is_err() {
reveal_fallback(path);
}
}
#[cfg(not(any(
all(target_os = "windows", target_arch = "x86_64"),
target_os = "macos"
)))]
{
fn reveal(path: impl AsRef<Path>) {
let path = path.as_ref();
if opener::reveal(path).is_err() {
reveal_fallback(path);
}
}
Expand Down

0 comments on commit c2303f8

Please sign in to comment.