326 } |
326 } |
327 } |
327 } |
328 } |
328 } |
329 |
329 |
330 private boolean prepareProto(Map<String, ? super Object> p) |
330 private boolean prepareProto(Map<String, ? super Object> p) |
331 throws IOException { |
331 throws PackagerException, IOException { |
332 File appImage = StandardBundlerParam.getPredefinedAppImage(p); |
332 File appImage = StandardBundlerParam.getPredefinedAppImage(p); |
333 File appDir = null; |
333 File appDir = null; |
334 |
334 |
335 // we either have an application image or need to build one |
335 // we either have an application image or need to build one |
336 if (appImage != null) { |
336 if (appImage != null) { |
372 |
372 |
373 if (icon.exists()) { |
373 if (icon.exists()) { |
374 try { |
374 try { |
375 IOUtils.copyFile(icon, faIconFile); |
375 IOUtils.copyFile(icon, faIconFile); |
376 } catch (IOException e) { |
376 } catch (IOException e) { |
377 e.printStackTrace(); |
377 Log.verbose(e); |
378 } |
378 } |
379 } |
379 } |
380 } |
380 } |
381 |
381 |
382 return true; |
382 return true; |
383 } |
383 } |
384 |
384 |
385 public File bundle(Map<String, ? super Object> p, File outdir) { |
385 public File bundle(Map<String, ? super Object> p, File outdir) |
|
386 throws PackagerException { |
386 if (!outdir.isDirectory() && !outdir.mkdirs()) { |
387 if (!outdir.isDirectory() && !outdir.mkdirs()) { |
387 throw new RuntimeException(MessageFormat.format( |
388 throw new PackagerException("error.cannot-create-output-dir", |
388 getString("error.cannot-create-output-dir"), |
389 outdir.getAbsolutePath()); |
389 outdir.getAbsolutePath())); |
|
390 } |
390 } |
391 if (!outdir.canWrite()) { |
391 if (!outdir.canWrite()) { |
392 throw new RuntimeException(MessageFormat.format( |
392 throw new PackagerException("error.cannot-write-to-output-dir", |
393 getString("error.cannot-write-to-output-dir"), |
393 outdir.getAbsolutePath()); |
394 outdir.getAbsolutePath())); |
|
395 } |
394 } |
396 |
395 |
397 if (WindowsDefender.isThereAPotentialWindowsDefenderIssue()) { |
396 if (WindowsDefender.isThereAPotentialWindowsDefenderIssue()) { |
398 Log.error(MessageFormat.format( |
397 Log.error(MessageFormat.format( |
399 getString("message.potential.windows.defender.issue"), |
398 getString("message.potential.windows.defender.issue"), |
401 } |
400 } |
402 |
401 |
403 // validate we have valid tools before continuing |
402 // validate we have valid tools before continuing |
404 String iscc = TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p); |
403 String iscc = TOOL_INNO_SETUP_COMPILER_EXECUTABLE.fetchFrom(p); |
405 if (iscc == null || !new File(iscc).isFile()) { |
404 if (iscc == null || !new File(iscc).isFile()) { |
406 Log.error(getString("error.iscc-not-found")); |
405 Log.verbose(getString("error.iscc-not-found")); |
407 Log.error(MessageFormat.format( |
406 Log.verbose(MessageFormat.format( |
408 getString("message.iscc-file-string"), iscc)); |
407 getString("message.iscc-file-string"), iscc)); |
409 return null; |
408 throw new PackagerException("error.iscc-not-found"); |
410 } |
409 } |
411 |
410 |
412 File imageDir = EXE_IMAGE_DIR.fetchFrom(p); |
411 File imageDir = EXE_IMAGE_DIR.fetchFrom(p); |
413 try { |
412 try { |
414 imageDir.mkdirs(); |
413 imageDir.mkdirs(); |
431 } |
430 } |
432 return buildEXE(p, outdir); |
431 return buildEXE(p, outdir); |
433 } |
432 } |
434 return null; |
433 return null; |
435 } catch (IOException ex) { |
434 } catch (IOException ex) { |
436 ex.printStackTrace(); |
435 Log.verbose(ex); |
437 return null; |
436 throw new PackagerException(ex); |
438 } |
437 } |
439 } |
438 } |
440 |
439 |
441 // name of post-image script |
440 // name of post-image script |
442 private File getConfig_Script(Map<String, ? super Object> p) { |
441 private File getConfig_Script(Map<String, ? super Object> p) { |