CLeanup, and get domain overlap and mapping adjustment working.
This commit is contained in:
44
src/main.rs
44
src/main.rs
@@ -18,10 +18,6 @@ const FB_PAD_VALUE: u8 = 0;
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let config = Args::parse();
|
||||
|
||||
// Live with it, prefer to use expect() here.
|
||||
// I'm lazy and don't want to mess around with comparing error types.
|
||||
// Thus, any error in I/O here should be treated as fatal.
|
||||
|
||||
let mut input: File = {
|
||||
let input_path = &config.input.as_path();
|
||||
|
||||
@@ -44,37 +40,23 @@ fn main() -> anyhow::Result<()> {
|
||||
.with_context(|| format!("Failed to open/create output file at: {}", path.display()))?
|
||||
};
|
||||
|
||||
/*
|
||||
let map: MapFile = {
|
||||
let path = get_path(
|
||||
&config.output,
|
||||
&config
|
||||
.input
|
||||
.to_str()
|
||||
.expect("Input path is not UTF-8 valid"),
|
||||
"map",
|
||||
);
|
||||
let path = crate::io::get_path(&config.output, &config.input, "map")
|
||||
.context("Failed to generate map path.")?;
|
||||
|
||||
let file = OpenOptions::new()
|
||||
.read(true)
|
||||
.create(true)
|
||||
.open(path)
|
||||
.expect("Failed to open/create mapping file");
|
||||
|
||||
if let Ok(map) = MapFile::try_from(file) {
|
||||
map
|
||||
} else {
|
||||
MapFile::new(config.sector_size)
|
||||
}
|
||||
MapFile::try_from(
|
||||
OpenOptions::new()
|
||||
.read(true)
|
||||
.create(true)
|
||||
.open(&path)
|
||||
.with_context(|| {
|
||||
format!("Failed to open/create mapping file at: {}", path.display())
|
||||
})?,
|
||||
)
|
||||
.unwrap_or(MapFile::new(config.sector_size))
|
||||
};
|
||||
*/
|
||||
|
||||
let mut recover_tool = {
|
||||
let buf_capacity = crate::io::get_stream_length(&mut input)
|
||||
.context("Failed to get buffer capacity from input")?;
|
||||
|
||||
Recover::new(&config, input, output, MapFile::default(), buf_capacity)
|
||||
};
|
||||
let mut recover_tool = Recover::new(&config, &mut input, output, map)?;
|
||||
|
||||
recover_tool.run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user