Skip to content

Commit

Permalink
* Now shows help message when run without any arguments
Browse files Browse the repository at this point in the history
* Also added instructions on SmartScreen warning
  • Loading branch information
CKingX committed Apr 18, 2022
1 parent 683aecb commit af41938
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ddrescue_error_mapping"
license = "AGPL-3.0-or-later"
version = "0.5.2"
version = "0.6.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Note the block device is the block device created with losetup. This command wil
This will create a new device at `/dev/mapper/<device name>` which you can use with tools. Tested with DMDE (for faster recovery, set retries to 0), UFS Explorer and R-Studio

## Install
ddr_error_mapping install binaries are available at [Releases](https://github.com/CKingX/ddrescue_error_mapping/releases) page for Windows and Linux binaries (x64 architecture only). I currently do not have a Mac to test ddr_error_mapping with, but building and running it should work regardless. (Note that ddr_error_mapping will only create the device mapping file. You still need Linux to create the device mapper block device!)
ddr_error_mapping install binaries are available at [Releases](https://github.com/CKingX/ddrescue_error_mapping/releases) page for Windows and Linux binaries (x64 architecture only). I currently do not have a Mac to test ddr_error_mapping with, but building and running it should work regardless. (Note that ddr_error_mapping will only create the device mapping file. You still need Linux to create the device mapper block device!) On Windows, you will get SmartScreen warning. The reason is that Microsoft only trusts apps that have a lot of downloads which punishes niche or newer apps. To get around it, click More Info and now Run Anyway button will appear.

## Build Guide
We can use cargo to build ddr_error_mapping. Currently tested with rustc version 1.60. To build, we first need to install rustup. For Windows, you can download rustup-init [here for Intel x64](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe) and [here for Intel 32-bit](https://static.rust-lang.org/rustup/dist/i686-pc-windows-msvc/rustup-init.exe). For Windows, it will offer to download build tools automatically. For Linux (make sure to install build tools like build-essentials on Ubuntu) and macOS (XCode commandline tools will be required), run this command below instead to install rustup:
Expand Down
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ const PARSE_ERROR: &str = "Unable to parse ddrescue map file";

fn main() {
let args: Vec<String> = env::args().collect();
if args.iter().count() < 3 {
let arg_count = args.iter().count();
if arg_count < 3 {
if let Some(arg) = args.iter().nth(1) {
if arg.contains("--version") || arg.contains("-v") {
println!("{VERSION}");
} else {
println!("{HELP}");
}
}
if arg_count == 1 {
println!("{HELP}");
}
process::exit(0);
}

Expand Down

0 comments on commit af41938

Please sign in to comment.