Enable automatic volume mounting before cloning
This commit is contained in:
parent
167ec52d6f
commit
cd38712ea9
2 changed files with 22 additions and 1 deletions
|
|
@ -129,7 +129,7 @@ pub fn get_partition_details(
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn build_dest_format_script(disk_id: usize, part_type: &PartitionTableType) -> String {
|
pub fn build_dest_format_script(disk_id: usize, part_type: &PartitionTableType) -> String {
|
||||||
let disk_id = format!("{disk_id}");
|
let disk_id = format!("{disk_id}");
|
||||||
let mut script = vec!["select disk {disk_id}", "clean"];
|
let mut script = vec!["automount enable noerr", "select disk {disk_id}", "clean"];
|
||||||
match part_type {
|
match part_type {
|
||||||
PartitionTableType::Guid => {
|
PartitionTableType::Guid => {
|
||||||
script.push("convert gpt");
|
script.push("convert gpt");
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ use core::{
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
iter::zip,
|
iter::zip,
|
||||||
|
path::PathBuf,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -170,11 +171,31 @@ impl App {
|
||||||
))?;
|
))?;
|
||||||
}
|
}
|
||||||
Mode::PreClone => {
|
Mode::PreClone => {
|
||||||
|
// Get System32 path
|
||||||
|
let system32 = if cfg!(windows) {
|
||||||
|
if let Ok(path) = env::var("SYSTEMROOT") {
|
||||||
|
format!("{path}/System32")
|
||||||
|
} else {
|
||||||
|
self.action_tx.send(Action::Error(String::from(
|
||||||
|
"ERROR\n\n\nFailed to find SYSTEMROOT",
|
||||||
|
)))?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String::from(".")
|
||||||
|
};
|
||||||
|
|
||||||
self.action_tx.send(Action::DisplayPopup(
|
self.action_tx.send(Action::DisplayPopup(
|
||||||
popup::Type::Info,
|
popup::Type::Info,
|
||||||
String::from("Formatting destination disk"),
|
String::from("Formatting destination disk"),
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
|
// (Re)Enable volume mounting
|
||||||
|
self.tasks.add(Task::Command(
|
||||||
|
PathBuf::from(format!("{system32}/mountvol.exe")),
|
||||||
|
vec![String::from("/e")],
|
||||||
|
));
|
||||||
|
|
||||||
// Build Diskpart script to format destination disk
|
// Build Diskpart script to format destination disk
|
||||||
let disk_list = self.clone.disk_list.lock().unwrap();
|
let disk_list = self.clone.disk_list.lock().unwrap();
|
||||||
if let Some(disk_index) = self.clone.disk_index_dest {
|
if let Some(disk_index) = self.clone.disk_index_dest {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue