Fix zero-based vs one-based indexing
This commit is contained in:
parent
8a65313039
commit
4a306b56d9
2 changed files with 18 additions and 6 deletions
|
|
@ -195,7 +195,7 @@ impl App {
|
|||
// Get image info
|
||||
let wim_sources = self.state.wim_sources.lock().unwrap();
|
||||
let wim_file = wim_sources.get_file(self.state.wim_file_index.unwrap());
|
||||
let wim_index = format!("{}", self.state.wim_image_index.unwrap());
|
||||
let wim_index = self.state.wim_image_index.unwrap() + 1; // wimapply uses 1-based index
|
||||
|
||||
// Add actions
|
||||
let disk_list = self.state.disk_list.lock().unwrap();
|
||||
|
|
@ -206,7 +206,12 @@ impl App {
|
|||
let dest_path = format!("{}:\\", disk.get_part_letter(num_parts - 1));
|
||||
self.tasks.add(TaskType::CommandWait(
|
||||
wimlib_imagex,
|
||||
vec![String::from("apply"), wim_file.path, wim_index, dest_path],
|
||||
vec![
|
||||
String::from("apply"),
|
||||
wim_file.path,
|
||||
format!("{wim_index}"),
|
||||
dest_path,
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,13 +176,20 @@ impl WimSources {
|
|||
}
|
||||
|
||||
pub fn get_file(&self, index: usize) -> WimFile {
|
||||
let rel_index: usize;
|
||||
let num_local = self.local.len();
|
||||
let index = if index < num_local {
|
||||
index
|
||||
let mut use_local = true;
|
||||
if index < num_local {
|
||||
rel_index = index;
|
||||
} else {
|
||||
index - num_local
|
||||
rel_index = index - num_local;
|
||||
use_local = false;
|
||||
};
|
||||
self.local.get(index).unwrap().clone()
|
||||
if use_local {
|
||||
self.local.get(rel_index).unwrap().clone()
|
||||
} else {
|
||||
self.network.get(rel_index).unwrap().clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_file_list(&self) -> Vec<WimFile> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue