Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2019-12-24 08:54:40 +0000
committerEd Merks2019-12-24 08:54:40 +0000
commit8144483681c0d27350923526454fb5f6c81419b2 (patch)
tree6fa2baa46738fc92ffb8dce265fb8a143bae60c5 /bundles/org.eclipse.equinox.p2.artifact.repository
parentc3a3766bc80e37a90b741d4b6a734f330213ecad (diff)
downloadrt.equinox.p2-8144483681c0d27350923526454fb5f6c81419b2.tar.gz
rt.equinox.p2-8144483681c0d27350923526454fb5f6c81419b2.tar.xz
rt.equinox.p2-8144483681c0d27350923526454fb5f6c81419b2.zip
side-effect of changing File.lastModified Change-Id: I8b6389654dbbb03cfa08252c520f12b225a708c8 Signed-off-by: Ed Merks <ed.merks@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
index 58bb0966b..22b65a2e1 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
@@ -17,6 +17,7 @@ package org.eclipse.equinox.internal.p2.artifact.repository;
import java.io.File;
import java.io.IOException;
import java.net.URI;
+import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.URIUtil;
@@ -94,15 +95,9 @@ public class Activator implements BundleActivator {
private boolean isReadOnly(File file) {
if (file == null)
return true; // If we've reached the root, then return true
+
if (file.exists()) {
- try {
- // on Vista/Windows 7 you are not allowed to write executable files on virtual directories like "Program Files"
- File tmpTestFile = File.createTempFile(".artifactlocktest", ".dll", file); //$NON-NLS-1$ //$NON-NLS-2$
- tmpTestFile.delete();
- return false;
- } catch (IOException e) {
- return true; // permission issue to create new file, so it's readonly
- }
+ return !Files.isWritable(file.toPath());
}
return isReadOnly(file.getParentFile());

Back to the top