Fixed pointess generate_str function return
Also added a nice little helpful close window thingy
This commit is contained in:
14
src/infos.rs
14
src/infos.rs
@@ -35,26 +35,26 @@ impl CommandManager {
|
||||
}
|
||||
pub fn remove_iwad(&mut self) {
|
||||
self.iwad = None;
|
||||
let _ = self.generate_command_str();
|
||||
self.update_command();
|
||||
}
|
||||
pub fn add_iwad(&mut self, iwad: &WadInfo) {
|
||||
self.iwad = Some(iwad.path.clone());
|
||||
let _ = self.generate_command_str();
|
||||
self.update_command();
|
||||
}
|
||||
pub fn add_pwads(&mut self, pwads: &Vec<&WadInfo>) {
|
||||
self.pwads = Vec::new();
|
||||
for pwad in pwads {
|
||||
self.pwads.push(pwad.path.clone());
|
||||
}
|
||||
let _ = self.generate_command_str();
|
||||
self.update_command();
|
||||
}
|
||||
pub fn add_launcher(&mut self, launcher: &LauncherInfo) {
|
||||
self.launcher = Some(launcher.path.clone());
|
||||
let _ = self.generate_command_str();
|
||||
self.update_command();
|
||||
}
|
||||
pub fn remove_launcher(&mut self) {
|
||||
self.launcher = None;
|
||||
let _ = self.generate_command_str();
|
||||
self.update_command();
|
||||
}
|
||||
pub fn generate_command(&self) -> Result<(String, Vec<String>), CommandErrors> {
|
||||
let launcher = if let Some(launcher) = &self.launcher {
|
||||
@@ -93,7 +93,8 @@ impl CommandManager {
|
||||
}
|
||||
Ok((launcher.to_str().unwrap().to_string(), command))
|
||||
}
|
||||
pub fn generate_command_str(&mut self) -> Result<(), CommandErrors> {
|
||||
|
||||
pub fn update_command(&mut self) {
|
||||
match self.generate_command() {
|
||||
Err(e) => {
|
||||
self.command_string = "plz add ".to_string();
|
||||
@@ -112,7 +113,6 @@ impl CommandManager {
|
||||
self.command_string = command;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user