Lines 8-13
Link Here
|
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
10 |
* Martin Oberhuber (Wind River) - [294429] Avoid substring baggage in FileInfo |
10 |
* Martin Oberhuber (Wind River) - [294429] Avoid substring baggage in FileInfo |
|
|
11 |
* Martin Oberhuber (Wind River) - [314448] error on exists() for non-accessible |
11 |
*******************************************************************************/ |
12 |
*******************************************************************************/ |
12 |
package org.eclipse.core.internal.filesystem.local; |
13 |
package org.eclipse.core.internal.filesystem.local; |
13 |
|
14 |
|
Lines 139-145
Link Here
|
139 |
return file.equals(otherFile.file); |
140 |
return file.equals(otherFile.file); |
140 |
} |
141 |
} |
141 |
|
142 |
|
142 |
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) { |
143 |
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException { |
143 |
if (LocalFileNativesManager.isUsingNatives()) { |
144 |
if (LocalFileNativesManager.isUsingNatives()) { |
144 |
FileInfo info = LocalFileNativesManager.fetchFileInfo(filePath); |
145 |
FileInfo info = LocalFileNativesManager.fetchFileInfo(filePath); |
145 |
//natives don't set the file name on all platforms |
146 |
//natives don't set the file name on all platforms |
Lines 212-218
Link Here
|
212 |
if (monitor.isCanceled()) { |
213 |
if (monitor.isCanceled()) { |
213 |
throw new OperationCanceledException(); |
214 |
throw new OperationCanceledException(); |
214 |
} |
215 |
} |
215 |
if (target.delete() || !target.exists()) |
216 |
if (target.delete()) |
216 |
return true; |
217 |
return true; |
217 |
if (target.isDirectory()) { |
218 |
if (target.isDirectory()) { |
218 |
monitor.subTask(NLS.bind(Messages.deleting, target)); |
219 |
monitor.subTask(NLS.bind(Messages.deleting, target)); |
Lines 246-258
Link Here
|
246 |
return false; |
247 |
return false; |
247 |
} |
248 |
} |
248 |
} |
249 |
} |
249 |
//if we got this far, we failed |
250 |
//if we got this far, we failed or the file never existed |
250 |
String message = null; |
251 |
String message = null; |
251 |
if (fetchInfo().getAttribute(EFS.ATTRIBUTE_READ_ONLY)) |
252 |
try { |
252 |
message = NLS.bind(Messages.couldnotDeleteReadOnly, target.getAbsolutePath()); |
253 |
IFileInfo info = fetchInfo(EFS.NONE, monitor); |
253 |
else |
254 |
if (!info.exists()) |
254 |
message = NLS.bind(Messages.couldnotDelete, target.getAbsolutePath()); |
255 |
return true; |
255 |
status.add(new Status(IStatus.ERROR, Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null)); |
256 |
else if (info.getAttribute(EFS.ATTRIBUTE_READ_ONLY)) |
|
|
257 |
message = NLS.bind(Messages.couldnotDeleteReadOnly, target.getAbsolutePath()); |
258 |
else |
259 |
message = NLS.bind(Messages.couldnotDelete, target.getAbsolutePath()); |
260 |
status.add(new Status(IStatus.ERROR, Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null)); |
261 |
} catch (CoreException ce) { |
262 |
status.add(ce.getStatus()); |
263 |
} |
256 |
return false; |
264 |
return false; |
257 |
} |
265 |
} |
258 |
|
266 |
|