/** The tool package executes tools/lib/post_tools_install[.bat|.sh] {@inheritDoc} */ @Override public void postInstallHook(Archive archive, ITaskMonitor monitor, File installFolder) { super.postInstallHook(archive, monitor, installFolder); if (installFolder == null) { return; } File libDir = new File(installFolder, SdkConstants.FD_LIB); if (!libDir.isDirectory()) { return; } String scriptName = "post_tools_install"; // $NON-NLS-1$ String shell = ""; // $NON-NLS-1$ if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_WINDOWS) { shell = "cmd.exe /c "; // $NON-NLS-1$ scriptName += ".bat"; // $NON-NLS-1$ } else { scriptName += ".sh"; // $NON-NLS-1$ } File scriptFile = new File(libDir, scriptName); if (!scriptFile.isFile()) { return; } Process proc; int status = -1; try { proc = Runtime.getRuntime() .exec( shell + scriptName, // command null, // environment libDir); // working dir status = grabProcessOutput(proc, monitor, scriptName); } catch (Exception e) { monitor.logError("Exception: %s", e.toString()); } if (status != 0) { monitor.logError("Failed to execute %s", scriptName); return; } }