how to delete a folder in workspace @ runtime? [message #200532] |
Mon, 19 March 2007 19:59 |
Eclipse User |
|
|
|
Originally posted by: bensonc.ca.ibm.com
Hi,
i would like to remove a folder at runtime, but somehow the folder did not
get deleted, here is my code to delete the folder:
Path changePath = new Path("\\Module1\\folder");
IFile addedFile =
ResourcesPlugin.getWorkspace().getRoot().getFile(changePath) ;
addedFile.delete(IResource.FORCE, null);
can you please tell me whats wrong?
i didn't not get any exception during the deletion, and the folder is empty
Thank you very much
|
|
|
Re: how to delete a folder in workspace @ runtime? [message #200710 is a reply to message #200532] |
Tue, 20 March 2007 23:54 |
Eclipse User |
|
|
|
Originally posted by: simon.crossleyit.co.uk
Use IFolder rather than IFile and this works fine
IProject proj =
ResourcesPlugin.getWorkspace().getRoot().getProject("Module1 ");
proj.create(null);
proj.open(null);
IFolder fol = proj.getFolder("folder");
fol.create(true, true, null);
Path changePath = new Path("\\Module1\\folder");
IFolder addedFile =
ResourcesPlugin.getWorkspace().getRoot().getFolder(changePat h);
assertTrue(addedFile.exists());
addedFile.delete(IResource.FORCE, null);
assertFalse(addedFile.exists());
Benson wrote:
> Hi,
> i would like to remove a folder at runtime, but somehow the folder did
> not get deleted, here is my code to delete the folder:
>
> Path changePath = new Path("\\Module1\\folder");
> IFile addedFile =
> ResourcesPlugin.getWorkspace().getRoot().getFile(changePath) ;
> addedFile.delete(IResource.FORCE, null);
>
> can you please tell me whats wrong?
> i didn't not get any exception during the deletion, and the folder is empty
>
> Thank you very much
>
|
|
|
Powered by
FUDForum. Page generated in 0.08486 seconds