File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
1
#[ cfg( feature = "color" ) ]
2
2
use colored:: Colorize ;
3
3
use serde:: { Deserialize , Serialize } ;
4
+ use std:: path:: PathBuf ;
4
5
use std:: { fmt, usize} ;
5
6
6
7
#[ cfg( feature = "elf" ) ]
@@ -89,7 +90,7 @@ impl fmt::Display for BinSpecificProperties {
89
90
#[ derive( Debug , Deserialize , Serialize ) ]
90
91
pub struct Binary {
91
92
pub binarytype : BinType ,
92
- pub file : String ,
93
+ pub file : PathBuf ,
93
94
pub properties : BinSpecificProperties ,
94
95
}
95
96
#[ cfg( not( feature = "color" ) ) ]
@@ -98,7 +99,9 @@ impl fmt::Display for Binary {
98
99
write ! (
99
100
f,
100
101
"{}: | {} | File: {}" ,
101
- self . binarytype, self . properties, self . file
102
+ self . binarytype,
103
+ self . properties,
104
+ self . file. display( )
102
105
)
103
106
}
104
107
}
@@ -111,14 +114,14 @@ impl fmt::Display for Binary {
111
114
self . binarytype,
112
115
self . properties,
113
116
"File:" . bold( ) . underline( ) ,
114
- self . file. bright_blue( )
117
+ self . file. display ( ) . to_string ( ) . bright_blue( )
115
118
)
116
119
}
117
120
}
118
121
impl Binary {
119
122
pub const fn new (
120
123
binarytype : BinType ,
121
- file : String ,
124
+ file : PathBuf ,
122
125
properties : BinSpecificProperties ,
123
126
) -> Self {
124
127
Self { binarytype, file, properties }
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ fn parse(file: &Path) -> Result<Vec<Binary>, ParseError> {
164
164
if elf. is_64 { BinType :: Elf64 } else { BinType :: Elf32 } ;
165
165
Ok ( vec ! [ Binary :: new(
166
166
bin_type,
167
- file. display ( ) . to_string ( ) ,
167
+ file. to_path_buf ( ) ,
168
168
BinSpecificProperties :: Elf ( results) ,
169
169
) ] )
170
170
}
@@ -175,7 +175,7 @@ fn parse(file: &Path) -> Result<Vec<Binary>, ParseError> {
175
175
if pe. is_64 { BinType :: PE64 } else { BinType :: PE32 } ;
176
176
Ok ( vec ! [ Binary :: new(
177
177
bin_type,
178
- file. display ( ) . to_string ( ) ,
178
+ file. to_path_buf ( ) ,
179
179
BinSpecificProperties :: PE ( results) ,
180
180
) ] )
181
181
}
@@ -190,7 +190,7 @@ fn parse(file: &Path) -> Result<Vec<Binary>, ParseError> {
190
190
} ;
191
191
Ok ( vec ! [ Binary :: new(
192
192
bin_type,
193
- file. display ( ) . to_string ( ) ,
193
+ file. to_path_buf ( ) ,
194
194
BinSpecificProperties :: MachO ( results) ,
195
195
) ] )
196
196
}
@@ -207,7 +207,7 @@ fn parse(file: &Path) -> Result<Vec<Binary>, ParseError> {
207
207
} ;
208
208
fat_bins. push ( Binary :: new (
209
209
bin_type,
210
- file. display ( ) . to_string ( ) ,
210
+ file. to_path_buf ( ) ,
211
211
BinSpecificProperties :: MachO ( results) ,
212
212
) ) ;
213
213
}
You can’t perform that action at this time.
0 commit comments