diff options
author | Sergey Prigogin | 2014-10-10 18:52:46 +0000 |
---|---|---|
committer | Sergey Prigogin | 2014-10-13 17:21:19 +0000 |
commit | 0c70b036a483cc0640e62b99b3f584444a39feab (patch) | |
tree | d9137c7400e07efb2d2a6ab76c8fc1f2e9c4f043 | |
parent | 4733d40d5203fcc910a997e4553ffb07ed93d348 (diff) | |
download | eclipse.platform.runtime-0c70b036a483cc0640e62b99b3f584444a39feab.tar.gz eclipse.platform.runtime-0c70b036a483cc0640e62b99b3f584444a39feab.tar.xz eclipse.platform.runtime-0c70b036a483cc0640e62b99b3f584444a39feab.zip |
Bug 446698 - CoreTest.canCreateSymLinks method should unconditionallyI20141028-0800I20141027-2000I20141027-0800I20141026-2100I20141021-0800I20141014-0800
return true on platforms other than Windows
Change-Id: I7d80ebcf4797cf18e21208156c548ebe4aec698f
Signed-off-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r-- | tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java | 26 |
1 files changed, 16 insertions, 10 deletions
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 e0ed760a0..4c6a8267d 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 @@ public class CoreTest extends TestCase { */ 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(); |