From 88bea6e9fb81e744d9b6331a9b529dda92d8be04 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Sat, 30 Nov 2024 12:31:43 +0100 Subject: [PATCH] reduce file access At least on Windows the repeated invocation of file.exists takes a huge amount of time. --- .../tycho/core/osgitools/DefaultArtifactDescriptor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java index 3c0fc4c62f..ad27d20265 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/DefaultArtifactDescriptor.java @@ -68,10 +68,13 @@ public File getLocation(boolean fetch) { if (projectLocation != null) { return projectLocation; } - if (fetch && locationSupplier != null && (location == null || !location.exists())) { + if (fetch && locationSupplier != null && location == null) { File file = locationSupplier.apply(this); if (file != null) { location = ArtifactCollection.normalizeLocation(file); + if (!location.exists()) { + location = null; + } } } return location;