From 888a494dad0b6c36d47cfbc452a53afb0ff4ccce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20W=C3=B6gerer?= Date: Mon, 15 Jan 2024 17:18:24 +0100 Subject: [PATCH] Only use -H:Path validation in non-bundle mode When a bundle gets applied, the -H:Path value is purely virtual before it gets redirected to imagePathOutputDir. Validating the virtual value makes no sense (and causes errors if the path does not exist anymore) --- .../src/com/oracle/svm/driver/NativeImage.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java index c230b49e1cde..23f204a2bbcd 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java @@ -1225,13 +1225,15 @@ private int completeImageBuild() { if (!imageNamePathParent.isAbsolute()) { imageNamePathParent = imagePath.resolve(imageNamePathParent); } - if (!Files.isDirectory(imageNamePathParent)) { - throw NativeImage.showError("Writing image to non-existent directory " + imageNamePathParent + " is not allowed. " + - "Create the missing directory if you want the image to be written to that location."); - } - if (!Files.isWritable(imageNamePathParent)) { - throw NativeImage.showError("Writing image to directory without write access " + imageNamePathParent + " is not possible. " + - "Ensure the directory has write access or specify image path with write access."); + if (!useBundle()) { + if (!Files.isDirectory(imageNamePathParent)) { + throw NativeImage.showError("Writing image to non-existent directory " + imageNamePathParent + " is not allowed. " + + "Create the missing directory if you want the image to be written to that location."); + } + if (!Files.isWritable(imageNamePathParent)) { + throw NativeImage.showError("Writing image to directory without write access " + imageNamePathParent + " is not possible. " + + "Ensure the directory has write access or specify image path with write access."); + } } imagePath = imageNamePathParent; /* Update arguments passed to builder */