Invert backup/setup bool

This commit is contained in:
2Shirt 2025-12-13 08:07:53 -08:00
parent 87ccc80602
commit cb7ba1a285
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 7 additions and 7 deletions

View file

@ -158,7 +158,7 @@ impl App {
&& let Some(index) = self.state.wim_image_index
{
let image = wim_sources.get_file(index);
if !image.is_setup {
if image.is_backup {
self.action_tx.send(Action::NextScreen)?;
}
}
@ -729,7 +729,7 @@ fn build_right_items(app: &App) -> Action {
DVLine::blank(),
]);
}
if wim_file.is_setup
if !wim_file.is_backup
&& let Some(username) = &app.state.username
{
label_dv_lines.append(&mut vec![DVLine {

View file

@ -154,13 +154,13 @@ pub fn scan_local_drives(
// Scan drives
to_check.iter().for_each(|scan_path| {
let is_setup = scan_path.ends_with("\\Images");
let is_backup = !scan_path.ends_with("\\Images");
if let Ok(read_dir) = read_dir(scan_path) {
read_dir.for_each(|item| {
if let Ok(item) = item
&& item.file_name().to_string_lossy().ends_with(".wim")
&& let Some(path_str) = item.path().to_str()
&& let Ok(new_source) = parse_wim_file(path_str, is_setup)
&& let Ok(new_source) = parse_wim_file(path_str, is_backup)
{
wim_files.push(new_source);
}

View file

@ -69,7 +69,7 @@ static WIN_BUILDS: LazyLock<HashMap<&str, &str>> = LazyLock::new(|| {
pub struct WimFile {
pub path: String,
pub images: Vec<WimImage>,
pub is_setup: bool,
pub is_backup: bool,
}
impl WimFile {
@ -237,7 +237,7 @@ fn get_wim_xml(wim_file: &str) -> std::io::Result<File> {
Ok(file)
}
pub fn parse_wim_file(wim_file: &str, is_setup: bool) -> std::io::Result<WimFile> {
pub fn parse_wim_file(wim_file: &str, is_backup: bool) -> std::io::Result<WimFile> {
let mut wim_images: Vec<WimImage> = Vec::new();
if !Path::new(wim_file).exists() {
return Err(std::io::Error::new(
@ -316,7 +316,7 @@ pub fn parse_wim_file(wim_file: &str, is_setup: bool) -> std::io::Result<WimFile
let wim_file = WimFile {
path: wim_file.to_string(),
images: wim_images,
is_setup,
is_backup,
};
Ok(wim_file)