mirror of
https://github.com/hinto-janai/gupax.git
synced 2025-01-10 20:14:30 +00:00
main: update absolute paths before starting processes
Some situations won't update the path and so starting processes didn't do anything and failed, this makes sure we have a valid path before starting.
This commit is contained in:
parent
04d270b37f
commit
e42e776f00
3 changed files with 17 additions and 7 deletions
|
@ -2,6 +2,7 @@
|
||||||
## Fixes
|
## Fixes
|
||||||
* macOS: Added warning (and solution) if `Gupax/P2Pool/XMRig` were quarantined by [`Gatekeeper`](https://support.apple.com/en-us/HT202491)
|
* macOS: Added warning (and solution) if `Gupax/P2Pool/XMRig` were quarantined by [`Gatekeeper`](https://support.apple.com/en-us/HT202491)
|
||||||
* P2Pool/XMRig: Added a red `Start` button on errors (bad PATH, invalid file, etc) and a solution in the tooltip
|
* P2Pool/XMRig: Added a red `Start` button on errors (bad PATH, invalid file, etc) and a solution in the tooltip
|
||||||
|
* P2Pool/XMRig: Fixed processes sometimes not starting after entering a custom PATH
|
||||||
* P2Pool: Fixed custom node selection sometimes using old values after save
|
* P2Pool: Fixed custom node selection sometimes using old values after save
|
||||||
* Miscellaneous UI changes and fixes
|
* Miscellaneous UI changes and fixes
|
||||||
|
|
||||||
|
|
|
@ -170,6 +170,12 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn update_absolute_path(&mut self) -> Result<(), TomlError> {
|
||||||
|
self.gupax.absolute_p2pool_path = into_absolute_path(self.gupax.p2pool_path.clone())?;
|
||||||
|
self.gupax.absolute_xmrig_path = into_absolute_path(self.gupax.xmrig_path.clone())?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
// Convert [&str] to [State]
|
// Convert [&str] to [State]
|
||||||
pub fn from_str(string: &str) -> Result<Self, TomlError> {
|
pub fn from_str(string: &str) -> Result<Self, TomlError> {
|
||||||
match toml::de::from_str(string) {
|
match toml::de::from_str(string) {
|
||||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1455,6 +1455,8 @@ impl eframe::App for App {
|
||||||
ui.set_enabled(ui_enabled);
|
ui.set_enabled(ui_enabled);
|
||||||
let color = if ui_enabled { GREEN } else { RED };
|
let color = if ui_enabled { GREEN } else { RED };
|
||||||
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("▶").color(color))).on_hover_text("Start P2Pool").on_disabled_hover_text(text).clicked() {
|
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("▶").color(color))).on_hover_text("Start P2Pool").on_disabled_hover_text(text).clicked() {
|
||||||
|
self.og.lock().unwrap().update_absolute_path();
|
||||||
|
self.state.update_absolute_path(); // The above checks make sure this can unwrap safely, probably should handle it though.
|
||||||
Helper::start_p2pool(&self.helper, &self.state.p2pool, &self.state.gupax.absolute_p2pool_path);
|
Helper::start_p2pool(&self.helper, &self.state.p2pool, &self.state.gupax.absolute_p2pool_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1515,16 +1517,17 @@ impl eframe::App for App {
|
||||||
}
|
}
|
||||||
ui.set_enabled(ui_enabled);
|
ui.set_enabled(ui_enabled);
|
||||||
let color = if ui_enabled { GREEN } else { RED };
|
let color = if ui_enabled { GREEN } else { RED };
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("▶").color(color))).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() {
|
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("▶").color(color))).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() {
|
||||||
|
self.og.lock().unwrap().update_absolute_path();
|
||||||
|
self.state.update_absolute_path(); // The above checks make sure this can unwrap safely, probably should handle it though.
|
||||||
|
if cfg!(windows) {
|
||||||
Helper::start_xmrig(&self.helper, &self.state.xmrig, &self.state.gupax.absolute_xmrig_path, Arc::clone(&self.sudo));
|
Helper::start_xmrig(&self.helper, &self.state.xmrig, &self.state.gupax.absolute_xmrig_path, Arc::clone(&self.sudo));
|
||||||
}
|
} else if cfg!(unix) {
|
||||||
#[cfg(target_family = "unix")]
|
|
||||||
if (ui_enabled && key.is_up() && !wants_input) || ui.add_sized([width, height], Button::new(RichText::new("▶").color(color))).on_hover_text("Start XMRig").on_disabled_hover_text(text).clicked() {
|
|
||||||
self.sudo.lock().unwrap().signal = ProcessSignal::Start;
|
self.sudo.lock().unwrap().signal = ProcessSignal::Start;
|
||||||
self.error_state.ask_sudo(&self.sudo);
|
self.error_state.ask_sudo(&self.sudo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
Loading…
Reference in a new issue