modules/jdk.packager/src/main/java/com/oracle/tools/packager/windows/WinExeBundler.java

Print this page




 368                 if (configScript.exists()) {
 369                     Log.info(MessageFormat.format(I18N.getString("message.running-wsh-script"), configScript.getAbsolutePath()));
 370                     IOUtils.run("wscript", configScript, VERBOSE.fetchFrom(p));
 371                 }
 372                 return buildEXE(p, outputDirectory);
 373             }
 374             return null;
 375         } catch (IOException ex) {
 376             ex.printStackTrace();
 377             return null;
 378         } finally {
 379             try {
 380                 if (VERBOSE.fetchFrom(p)) {
 381                     saveConfigFiles(p);
 382                 }
 383                 if (imageDir != null && !Log.isDebug()) {
 384                     IOUtils.deleteRecursive(imageDir);
 385                 } else if (imageDir != null) {
 386                     Log.info(MessageFormat.format(I18N.getString("message.debug-working-directory"), imageDir.getAbsolutePath()));
 387                 }
 388             } catch (FileNotFoundException ex) {
 389                 //noinspection ReturnInsideFinallyBlock

 390                 return null;
 391             }
 392         }
 393     }
 394 
 395     //name of post-image script
 396     private File getConfig_Script(Map<String, ? super Object> params) {
 397         return new File(EXE_IMAGE_DIR.fetchFrom(params), APP_NAME.fetchFrom(params) + "-post-image.wsf");
 398     }
 399 
 400     protected void saveConfigFiles(Map<String, ? super Object> params) {
 401         try {
 402             File configRoot = CONFIG_ROOT.fetchFrom(params);
 403             if (getConfig_ExeProjectFile(params).exists()) {
 404                 IOUtils.copyFile(getConfig_ExeProjectFile(params),
 405                         new File(configRoot, getConfig_ExeProjectFile(params).getName()));
 406             }
 407             if (getConfig_Script(params).exists()) {
 408                 IOUtils.copyFile(getConfig_Script(params),
 409                         new File(configRoot, getConfig_Script(params).getName()));




 368                 if (configScript.exists()) {
 369                     Log.info(MessageFormat.format(I18N.getString("message.running-wsh-script"), configScript.getAbsolutePath()));
 370                     IOUtils.run("wscript", configScript, VERBOSE.fetchFrom(p));
 371                 }
 372                 return buildEXE(p, outputDirectory);
 373             }
 374             return null;
 375         } catch (IOException ex) {
 376             ex.printStackTrace();
 377             return null;
 378         } finally {
 379             try {
 380                 if (VERBOSE.fetchFrom(p)) {
 381                     saveConfigFiles(p);
 382                 }
 383                 if (imageDir != null && !Log.isDebug()) {
 384                     IOUtils.deleteRecursive(imageDir);
 385                 } else if (imageDir != null) {
 386                     Log.info(MessageFormat.format(I18N.getString("message.debug-working-directory"), imageDir.getAbsolutePath()));
 387                 }
 388             } catch (IOException ex) {
 389                 //noinspection ReturnInsideFinallyBlock
 390                 Log.debug(ex.getMessage());
 391                 return null;
 392             }
 393         }
 394     }
 395 
 396     //name of post-image script
 397     private File getConfig_Script(Map<String, ? super Object> params) {
 398         return new File(EXE_IMAGE_DIR.fetchFrom(params), APP_NAME.fetchFrom(params) + "-post-image.wsf");
 399     }
 400 
 401     protected void saveConfigFiles(Map<String, ? super Object> params) {
 402         try {
 403             File configRoot = CONFIG_ROOT.fetchFrom(params);
 404             if (getConfig_ExeProjectFile(params).exists()) {
 405                 IOUtils.copyFile(getConfig_ExeProjectFile(params),
 406                         new File(configRoot, getConfig_ExeProjectFile(params).getName()));
 407             }
 408             if (getConfig_Script(params).exists()) {
 409                 IOUtils.copyFile(getConfig_Script(params),
 410                         new File(configRoot, getConfig_Script(params).getName()));