@@ -227,14 +227,16 @@ public ToolInstallation installTool(ToolInstallRequest request) {
227227 *
228228 * @param request the {@link ToolInstallRequest}.
229229 * @param installationPath the target {@link Path} where the {@link #getName() tool} should be installed.
230- * @see #doInstall(ToolInstallRequest, Path)
230+ * @see #doInstall(ToolInstallRequest, Path, Path )
231231 */
232232 protected void performToolInstallation (ToolInstallRequest request , Path installationPath ) {
233233
234234 installDependencies (request );
235235 FileAccess fileAccess = this .context .getFileAccess ();
236236 ToolEditionAndVersion requested = request .getRequested ();
237237 VersionIdentifier resolvedVersion = requested .getResolvedVersion ();
238+ Path downloadedToolFile = getDownloadedToolFile (request );
239+
238240 if (Files .isDirectory (installationPath )) {
239241 if (this .tool .equals (IdeasyCommandlet .TOOL_NAME )) {
240242 LOG .warn ("Your IDEasy installation is missing the version file." );
@@ -244,14 +246,25 @@ protected void performToolInstallation(ToolInstallRequest request, Path installa
244246 }
245247 fileAccess .mkdirs (installationPath .getParent ());
246248
247- doInstall (request , installationPath );
249+ doInstall (request , installationPath , downloadedToolFile );
248250
249251 this .context .writeVersionFile (resolvedVersion , installationPath );
250252 // fix macOS Gatekeeper blocking - must run after version file is written but before any executables are launched
251253 getMacOsHelper ().removeQuarantineAttribute (installationPath );
252254 LOG .debug ("Installed {} in version {} at {}" , this .tool , resolvedVersion , installationPath );
253255 }
254256
257+ /**
258+ * @param request the {@link ToolInstallRequest}.
259+ * @return the {@link Path} to the downloaded tool file.
260+ */
261+ protected Path getDownloadedToolFile (ToolInstallRequest request ) {
262+
263+ ToolEditionAndVersion requested = request .getRequested ();
264+ VersionIdentifier resolvedVersion = requested .getResolvedVersion ();
265+ return downloadTool (requested .getEdition ().edition (), resolvedVersion );
266+ }
267+
255268 /**
256269 * Hook to install dependencies of this tool.
257270 *
@@ -263,17 +276,15 @@ protected void installDependencies(ToolInstallRequest request) {
263276 }
264277
265278 /**
266- * Hook for the actual installation of the {@link #getName() tool}. The default implementation performs a
267- * {@link #downloadTool(String, VersionIdentifier) download} and {@link FileAccess#extract(Path, Path, java.util.function.Consumer, boolean) extraction}.
279+ * Hook for the actual installation of the {@link #getName() tool}. The default implementation performs an
280+ * {@link FileAccess#extract(Path, Path, java.util.function.Consumer, boolean) extraction}.
268281 *
269282 * @param request the {@link ToolInstallRequest}.
270283 * @param installationPath the target {@link Path} where the {@link #getName() tool} should be installed.
284+ * @param downloadedToolFile the {@link Path} to the downloaded tool file.
271285 */
272- protected void doInstall (ToolInstallRequest request , Path installationPath ) {
286+ protected void doInstall (ToolInstallRequest request , Path installationPath , Path downloadedToolFile ) {
273287
274- ToolEditionAndVersion requested = request .getRequested ();
275- VersionIdentifier resolvedVersion = requested .getResolvedVersion ();
276- Path downloadedToolFile = downloadTool (requested .getEdition ().edition (), resolvedVersion );
277288 boolean extract = isExtract ();
278289 if (!extract ) {
279290 LOG .trace ("Extraction is disabled for '{}' hence just moving the downloaded file {}." , this .tool , downloadedToolFile );
0 commit comments