-
-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathfile_id.rs
More file actions
27 lines (21 loc) · 630 Bytes
/
file_id.rs
File metadata and controls
27 lines (21 loc) · 630 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::io;
use file_id::FileId;
fn main() {
let path = std::env::args().nth(1).expect("no path given");
print_file_id(&path);
}
#[cfg(any(target_family = "unix", target_family = "wasm"))]
fn print_file_id(path: &str) {
print_result(file_id::get_file_id(path));
}
#[cfg(target_family = "windows")]
fn print_file_id(path: &str) {
print_result(file_id::get_low_res_file_id(path));
print_result(file_id::get_high_res_file_id(path));
}
fn print_result(result: io::Result<FileId>) {
match result {
Ok(file_id) => println!("{file_id:?}"),
Err(error) => println!("Error: {error}"),
}
}