@@ -400,20 +400,19 @@ fn create_game_storage<F: Read + Write + Seek>(comp: &mut CompoundFile<F>) -> io
400
400
comp. create_storage ( & game_stg_path)
401
401
}
402
402
403
- /// Extracts the vbs script from an existing `vpx` file and writes it next to the file as sidecar script .
403
+ /// Extracts the script from an existing `vpx` file.
404
404
///
405
- /// @param vpx_file_path Path to the VPX file
406
- /// @param overwrite If true, the script will be extracted even if it already exists
407
- /// @param extension If set, the script will be written to a file with that extension instead of `vbs`
408
- ///
409
- /// *When Visual Pinball finds this script it will use that instead of the one embedded in the file.*
405
+ /// # Arguments
406
+ /// * `vpx_file_path` Path to the VPX file
407
+ /// * `vbs_file_path` Optional path to the script file to write. Defaults to the VPX sidecar script location.
408
+ /// * `overwrite` If true, the script will be extracted even if it already exists
410
409
pub fn extractvbs (
411
410
vpx_file_path : & PathBuf ,
411
+ vbs_file_path : Option < PathBuf > ,
412
412
overwrite : bool ,
413
- extension : Option < & str > ,
414
413
) -> io:: Result < ExtractResult > {
415
- let script_path = match extension {
416
- Some ( ext ) => path_for ( vpx_file_path , ext ) ,
414
+ let script_path = match vbs_file_path {
415
+ Some ( vbs_file_path ) => vbs_file_path ,
417
416
None => vbs_path_for ( vpx_file_path) ,
418
417
} ;
419
418
@@ -428,12 +427,16 @@ pub fn extractvbs(
428
427
}
429
428
}
430
429
431
- /// Imports the sidecar script into the provided `vpx` file.
430
+ /// Imports a script into the provided `vpx` file.
431
+ ///
432
+ /// # Arguments
433
+ /// * `vpx_file_path` Path to the VPX file
434
+ /// * `vbs_file_path` Optional path to the script file to import. Defaults to the VPX sidecar script location.
432
435
///
433
436
/// see also [extractvbs]
434
- pub fn importvbs ( vpx_file_path : & PathBuf , extension : Option < & str > ) -> io:: Result < PathBuf > {
435
- let script_path = match extension {
436
- Some ( ext ) => path_for ( vpx_file_path , ext ) ,
437
+ pub fn importvbs ( vpx_file_path : & PathBuf , vbs_file_path : Option < PathBuf > ) -> io:: Result < PathBuf > {
438
+ let script_path = match vbs_file_path {
439
+ Some ( vbs_file_path ) => vbs_file_path ,
437
440
None => vbs_path_for ( vpx_file_path) ,
438
441
} ;
439
442
if !script_path. exists ( ) {
@@ -1236,7 +1239,7 @@ mod tests {
1236
1239
let test_vpx_path = dir. join ( "test.vpx" ) ;
1237
1240
// make an empty file
1238
1241
File :: create ( & test_vpx_path) . unwrap ( ) ;
1239
- let result = extractvbs ( & test_vpx_path, false , None ) ;
1242
+ let result = extractvbs ( & test_vpx_path, None , false ) ;
1240
1243
let script_path = vbs_path_for ( & test_vpx_path) ;
1241
1244
assert ! ( result. is_err( ) ) ;
1242
1245
assert_eq ! (
0 commit comments