Bug 446698 - CoreTest.canCreateSymLinks method should unconditionally
return true on platforms other than Windows
Change-Id: I7d80ebcf4797cf18e21208156c548ebe4aec698f
Signed-off-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
diff --git a/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java b/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java
index e0ed760..4c6a826 100644
--- a/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java
+++ b/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java
@@ -248,17 +248,23 @@
*/
protected boolean canCreateSymLinks() {
if (canCreateSymLinks == null) {
- IPath tempDir = getTempDir();
- String linkName = FileSystemHelper.getRandomLocation(tempDir).lastSegment();
- try {
- // Try to create a symlink.
- createSymLink(tempDir.toFile(), linkName, "testTarget", false);
- // Clean up if the link was created.
- new File(tempDir.toFile(), linkName).delete();
+ if (isWindowsVistaOrHigher()) {
+ // Creation of a symbolic link on Windows requires administrator privileges,
+ // so it may or may not be possible.
+ IPath tempDir = getTempDir();
+ String linkName = FileSystemHelper.getRandomLocation(tempDir).lastSegment();
+ try {
+ // Try to create a symlink.
+ createSymLink(tempDir.toFile(), linkName, "testTarget", false);
+ // Clean up if the link was created.
+ new File(tempDir.toFile(), linkName).delete();
+ canCreateSymLinks = Boolean.TRUE;
+ } catch (AssertionFailedError e) {
+ // This exception indicates that creation of the symlink failed.
+ canCreateSymLinks = Boolean.FALSE;
+ }
+ } else {
canCreateSymLinks = Boolean.TRUE;
- } catch (AssertionFailedError e) {
- // This exception indicates that creation of the symlink failed.
- canCreateSymLinks = Boolean.FALSE;
}
}
return canCreateSymLinks.booleanValue();