@@ -570,26 +570,22 @@ fn copy_dynamic_libraries(sdl2_compiled_path: &PathBuf, target_os: &str) {
570
570
if target_os. contains ( "windows" ) {
571
571
let sdl2_dll_name = format ! ( "SDL2{}.dll" , debug_postfix( ) ) ;
572
572
let sdl2_bin_path = sdl2_compiled_path. join ( "bin" ) ;
573
- // Copy the file to both the target dir (as a product ship product of the build)
574
- // and to the deps sub directory, as comment example testing doesn't pick up the library
575
- // search path otherwise and fails.
576
- let target_path = find_cargo_target_dir ( ) ;
577
- let deps_path = target_path. join ( "deps" ) ;
578
-
579
573
let src_dll_path = sdl2_bin_path. join ( & sdl2_dll_name) ;
580
- let dst_dll_target_path = target_path. join ( & sdl2_dll_name) ;
581
- let dst_dll_deps_path = deps_path. join ( & sdl2_dll_name) ;
582
574
583
- fs:: copy ( & src_dll_path, & dst_dll_target_path) . expect ( & format ! (
584
- "Failed to copy SDL2 dynamic library from {} to {}" ,
585
- src_dll_path. to_string_lossy( ) ,
586
- dst_dll_target_path. to_string_lossy( )
587
- ) ) ;
588
- fs:: copy ( & src_dll_path, & dst_dll_deps_path) . expect ( & format ! (
589
- "Failed to copy SDL2 dynamic library from {} to {}" ,
590
- src_dll_path. to_string_lossy( ) ,
591
- dst_dll_deps_path. to_string_lossy( )
592
- ) ) ;
575
+ // Copy the dll to:
576
+ // * target dir: as a product ship product of the build,
577
+ // * deps directory: as comment example testing doesn't pick up the library search path
578
+ // otherwise and fails.
579
+ let target_path = find_cargo_target_dir ( ) ;
580
+ let deps_path = target_path. join ( "deps" ) ;
581
+ for path in & [ target_path, deps_path] {
582
+ let dst_dll_path = path. join ( & sdl2_dll_name) ;
583
+ fs:: copy ( & src_dll_path, & dst_dll_path) . expect ( & format ! (
584
+ "Failed to copy SDL2 dynamic library from {} to {}" ,
585
+ src_dll_path. to_string_lossy( ) ,
586
+ dst_dll_path. to_string_lossy( )
587
+ ) ) ;
588
+ }
593
589
}
594
590
}
595
591
0 commit comments