### Eclipse Workspace Patch 1.0 #P org.eclipse.core.resources Index: src/org/eclipse/core/internal/resources/LocationValidator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/LocationValidator.java,v retrieving revision 1.20 diff -u -r1.20 LocationValidator.java --- src/org/eclipse/core/internal/resources/LocationValidator.java 8 Oct 2010 16:39:17 -0000 1.20 +++ src/org/eclipse/core/internal/resources/LocationValidator.java 29 Oct 2010 15:21:18 -0000 @@ -12,7 +12,7 @@ package org.eclipse.core.internal.resources; import java.net.URI; -import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.*; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.internal.utils.FileUtil; import org.eclipse.core.internal.utils.Messages; @@ -371,6 +371,17 @@ return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message); } } + // test if the given location is read only (bug 285017) + try { + IFileStore store = EFS.getStore(location); + IFileInfo fileInfo = store.fetchInfo(); + if (FileUtil.fileInfoToAttributes(fileInfo).isReadOnly()) { + message = NLS.bind(Messages.resources_readOnly, toString(location)); + return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message); + } + } catch (CoreException e) { + return e.getStatus(); + } // Iterate over each known project and ensure that the location does not // conflict with any of their already defined locations.