Skip to content

Commit

Permalink
Fix release build for musl targets
Browse files Browse the repository at this point in the history
  • Loading branch information
ergrelet committed Mar 24, 2024
1 parent f4fb41b commit 425a277
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ SUBCOMMANDS:

## How to Build

On **Ubuntu**, you might need to install: `libxcb-shape0-dev` and `libxcb-xfixes0-dev`.
On **Ubuntu**, you might need to install: `libxcb-shape0-dev`,
`libxcb-xfixes0-dev` and `libglib2.0-dev`.

```
git clone https://github.com/ergrelet/resym.git && cd resym
Expand Down
11 changes: 9 additions & 2 deletions resym/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ anyhow = "1.0"
log = "0.4"
memory_logger = { version = "0.1", features = ["blocking"] }
crossbeam-channel = "0.5"
rfd = "0.11"
# Note(ergrelet): `fancy-regex` is less performant than `onig` at the moment
# but is more portable (i.e., compiles to wasm32)
syntect = { version = "5.2", default-features = false, features=["default-fancy"] }
Expand All @@ -41,10 +40,18 @@ ahash = { version = "0.8", default-features = false, features = [
"std",
] }

# Web:
# Non-Web
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Note(ergrlet): use `tinyfiledialogs` by default as it's quite portable on
# non-wasm platforms
tinyfiledialogs = "3.9"

# Web
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
wasm-bindgen-futures = "0.4"
# Use rfd on wasm platforms, instead of `tinyfiledialogs`
rfd = "0.11"

[target.'cfg(windows)'.build-dependencies]
winres = "0.1"
Expand Down
27 changes: 13 additions & 14 deletions resym/src/resym_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,13 +835,15 @@ impl ResymApp {
/// Function invoked on `Open PDB File` or when the Ctrl+O shortcut is used
#[cfg(not(target_arch = "wasm32"))]
fn start_open_pdb_file(&mut self, pdb_slot: PDBSlot) {
let file_path_opt = rfd::FileDialog::new()
.add_filter("PDB files (*.pdb)", &["pdb"])
.pick_file();
let file_path_opt = tinyfiledialogs::open_file_dialog(
"Select a PDB file",
"",
Some((&["*.pdb"], "PDB files (*.pdb)")),
);
if let Some(file_path) = file_path_opt {
if let Err(err) = self
.backend
.send_command(BackendCommand::LoadPDBFromPath(pdb_slot, file_path))
.send_command(BackendCommand::LoadPDBFromPath(pdb_slot, file_path.into()))
{
log::error!("Failed to load the PDB file: {err}");
}
Expand Down Expand Up @@ -901,19 +903,16 @@ impl ResymApp {
#[cfg(not(target_arch = "wasm32"))]
fn start_save_reconstruted_content(&self) {
if let ResymAppMode::Browsing(_, _, ref reconstructed_type) = self.current_mode {
let file_path_opt = rfd::FileDialog::new()
.add_filter(
"C/C++ Source File (*.c;*.cc;*.cpp;*.cxx;*.h;*.hpp;*.hxx)",
&["c", "cc", "cpp", "cxx", "h", "hpp", "hxx"],
)
.save_file();
let file_path_opt = tinyfiledialogs::save_file_dialog_with_filter(
"Save content to file",
"",
&["*.c", "*.cc", "*.cpp", "*.cxx", "*.h", "*.hpp", "*.hxx"],
"C/C++ Source File (*.c;*.cc;*.cpp;*.cxx;*.h;*.hpp;*.hxx)",
);
if let Some(file_path) = file_path_opt {
let write_result = std::fs::write(&file_path, reconstructed_type);
match write_result {
Ok(()) => log::info!(
"Reconstructed content has been saved to '{}'.",
file_path.display()
),
Ok(()) => log::info!("Reconstructed content has been saved to '{file_path}'."),
Err(err) => {
log::error!("Failed to write reconstructed content to file: {err}");
}
Expand Down

0 comments on commit 425a277

Please sign in to comment.