File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,8 @@ fn main() {
226
226
tcfg. emit_modules = true
227
227
} ;
228
228
229
+ let mut created_temp_compile_commands = false ;
230
+
229
231
let compile_commands = if args. compile_commands . len ( ) == 1
230
232
&& args. compile_commands [ 0 ] . extension ( ) == Some ( std:: ffi:: OsStr :: new ( "json" ) )
231
233
{
@@ -244,6 +246,7 @@ fn main() {
244
246
Exactly one compile_commands.json file should be provided, or a list of source files, but not both." ) ;
245
247
} else {
246
248
// Handle as a list of source files
249
+ created_temp_compile_commands = true ;
247
250
c2rust_transpile:: create_temp_compile_commands ( & args. compile_commands )
248
251
} ;
249
252
@@ -256,7 +259,7 @@ fn main() {
256
259
c2rust_transpile:: transpile ( tcfg, & compile_commands, & extra_args) ;
257
260
258
261
// Remove the temporary compile_commands.json if it was created
259
- if args . compile_commands . len ( ) > 0 {
262
+ if created_temp_compile_commands {
260
263
std:: fs:: remove_file ( & compile_commands)
261
264
. expect ( "Failed to remove temporary compile_commands.json" ) ;
262
265
}
You can’t perform that action at this time.
0 commit comments