aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2012-05-11 13:41:51 -0400
committerJohn Arthorne2012-05-11 13:41:51 -0400
commit04ef5def15b7ac819c89fe9843018347f53a38b8 (patch)
tree4343f1c134d04e83d15c124786d8ba5f005b5092
parent4f824de209f73abbc8a1e78b4b39d385f1364eb6 (diff)
downloadeclipse.platform.resources-04ef5def15b7ac819c89fe9843018347f53a38b8.zip
eclipse.platform.resources-04ef5def15b7ac819c89fe9843018347f53a38b8.tar.gz
eclipse.platform.resources-04ef5def15b7ac819c89fe9843018347f53a38b8.tar.xz
-rw-r--r--tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java
index c2366ed..202f3e9 100644
--- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java
+++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java
@@ -965,7 +965,18 @@ public abstract class ResourceTest extends CoreTest {
String[] devices = new String[2];
for (int i = 97/*a*/; i < 123/*z*/; i++) {
char c = (char) i;
- if (new java.io.File(c + ":\\").exists() && new java.io.File(c + ":\\").canWrite()) {
+ java.io.File rootFile = new java.io.File(c + ":\\");
+ if (rootFile.exists() && rootFile.canWrite()) {
+ //sometimes canWrite can return true but we are still not allowed to create a file - see bug 379284.
+ File probe = new File(rootFile, getUniqueString());
+ try {
+ probe.createNewFile();
+ } catch (IOException e) {
+ //can't create a file here.. try another device
+ continue;
+ } finally {
+ probe.delete();
+ }
if (devices[0] == null) {
devices[0] = c + ":/";
} else {