File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ uuid.workspace = true
1111
1212[target .'cfg(target_os = "windows")' .dependencies ]
1313uuid.workspace = true
14- windows = { version = " 0.60" , features = [" System_Profile" ] }
14+ windows = { version = " 0.60" , features = [
15+ " System_Profile_SystemManufacturers" ,
16+ ] }
1517
1618[lints ]
1719workspace = true
Original file line number Diff line number Diff line change @@ -4,9 +4,14 @@ const HEX_BASE: u32 = 16;
44
55impl crate :: Fingerprint {
66 pub fn new ( ) -> Option < Self > {
7- fs:: read_to_string ( "/etc/machine-id" )
8- . ok ( )
9- . and_then ( |id| u128:: from_str_radix ( & id, HEX_BASE ) . ok ( ) )
7+ parse_machine_id ( "/var/lib/dbus/machine-id" )
8+ . or_else ( || parse_machine_id ( "/etc/machine-id" ) )
109 . map ( Self )
1110 }
1211}
12+
13+ fn parse_machine_id ( path : & str ) -> Option < u128 > {
14+ fs:: read_to_string ( path)
15+ . ok ( )
16+ . and_then ( |id| u128:: from_str_radix ( id. trim ( ) , HEX_BASE ) . ok ( ) )
17+ }
You can’t perform that action at this time.
0 commit comments