mirror of https://github.com/encounter/objdiff.git
Compare commits
2 Commits
a0371dd110
...
d1d6f1101b
Author | SHA1 | Date |
---|---|---|
Luke Street | d1d6f1101b | |
Luke Street | bc7cce7226 |
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "objdiff"
|
name = "objdiff"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.62"
|
rust-version = "1.62"
|
||||||
authors = ["Luke Street <luke@street.dev>"]
|
authors = ["Luke Street <luke@street.dev>"]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
env::{current_dir, current_exe},
|
env::{current_dir, current_exe},
|
||||||
fs,
|
|
||||||
fs::File,
|
fs::File,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::mpsc::Receiver,
|
sync::mpsc::Receiver,
|
||||||
|
@ -44,7 +43,7 @@ fn run_update(status: &Status, cancel: Receiver<()>) -> Result<Box<UpdateResult>
|
||||||
.to_dest(&target_file)?;
|
.to_dest(&target_file)?;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::{fs, os::unix::fs::PermissionsExt};
|
||||||
let mut perms = fs::metadata(&target_file)?.permissions();
|
let mut perms = fs::metadata(&target_file)?.permissions();
|
||||||
perms.set_mode(0o755);
|
perms.set_mode(0o755);
|
||||||
fs::set_permissions(&target_file, perms)?;
|
fs::set_permissions(&target_file, perms)?;
|
||||||
|
|
|
@ -81,12 +81,14 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc<RwLock<AppConfig>>, view_state:
|
||||||
if state.update_available {
|
if state.update_available {
|
||||||
ui.colored_label(Color32::LIGHT_GREEN, "Update available");
|
ui.colored_label(Color32::LIGHT_GREEN, "Update available");
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
if state.found_binary && ui
|
if state.found_binary
|
||||||
|
&& ui
|
||||||
.button("Automatic")
|
.button("Automatic")
|
||||||
.on_hover_text_at_pointer(
|
.on_hover_text_at_pointer(
|
||||||
"Automatically download and replace the current build",
|
"Automatically download and replace the current build",
|
||||||
)
|
)
|
||||||
.clicked() {
|
.clicked()
|
||||||
|
{
|
||||||
view_state.jobs.push(queue_update());
|
view_state.jobs.push(queue_update());
|
||||||
}
|
}
|
||||||
if ui
|
if ui
|
||||||
|
@ -183,21 +185,19 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc<RwLock<AppConfig>>, view_state:
|
||||||
ui.separator();
|
ui.separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(base_dir) = base_obj_dir {
|
if let (Some(base_dir), Some(target_dir)) = (base_obj_dir, target_obj_dir) {
|
||||||
if ui.button("Select obj").clicked() {
|
if ui.button("Select obj").clicked() {
|
||||||
if let Some(path) = rfd::FileDialog::new()
|
if let Some(path) = rfd::FileDialog::new()
|
||||||
.set_directory(&base_dir)
|
.set_directory(&target_dir)
|
||||||
.add_filter("Object file", &["o", "elf"])
|
.add_filter("Object file", &["o", "elf"])
|
||||||
.pick_file()
|
.pick_file()
|
||||||
{
|
{
|
||||||
let mut new_build_obj: Option<String> = None;
|
let mut new_build_obj: Option<String> = None;
|
||||||
if let Ok(obj_path) = path.strip_prefix(&base_dir) {
|
if let Ok(obj_path) = path.strip_prefix(&base_dir) {
|
||||||
new_build_obj = Some(obj_path.display().to_string());
|
new_build_obj = Some(obj_path.display().to_string());
|
||||||
} else if let Some(build_asm_dir) = target_obj_dir {
|
} else if let Ok(obj_path) = path.strip_prefix(&target_dir) {
|
||||||
if let Ok(obj_path) = path.strip_prefix(&build_asm_dir) {
|
|
||||||
new_build_obj = Some(obj_path.display().to_string());
|
new_build_obj = Some(obj_path.display().to_string());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if let Some(new_build_obj) = new_build_obj {
|
if let Some(new_build_obj) = new_build_obj {
|
||||||
*obj_path = Some(new_build_obj);
|
*obj_path = Some(new_build_obj);
|
||||||
view_state
|
view_state
|
||||||
|
|
Loading…
Reference in New Issue