Community
Participate
Working Groups
If you create a project pointing at a directory where all of the contents are read only you cannot be rid of it. STEPS 1) Create a project Foo whose location is your CD ROM drive 2) Select delete on Foo. It will ask if you want to delete the contents from the file system. 3) Say no - you will now get prompted for each one being deleted. 4) No matter what you cannot get rid of Foo NOTES: TC (6/12/01 1:49:17 PM) - interestingly this works fine if you choose to do the same thing on a read only file on the file system. Just select yes to deletion and it deletes the resource but leaves the file alone. SA (10/10/2001 10:34:40 AM) In build 0.202, this problem still exist. Here some more details on what is going on. When a project is created and its location points to a read-only directory (and all files contained in the directory is read-only), the equivalent resouces are created in the workspace with the read-only flag on. So when you delete the project, the first dialog prompts if you want to delete the actual files and directories in the file system. The next prompt you get is if you want to delete the read-only resource project in the workspace (you also get prompted for all the resources in the project if they are read-only also). I guess the confusion comes from the message in the prompts? I too was fooled the first time I ran this. At the very least, we need to update the messages in the prompts (maybe add the words "project" or "workspace resource", etc). Or maybe we should change how this is presented to the user? (no ideas at the moment of course).
PRODUCT VERSION: 122
Wasn't this one fixed in the 1.0 patch?
Just checked in the wswb rollup - this problem still existed in the 1.0 refresh.
This is a Core bug We are calling the IProject.delete with the delete contents flag set to false. The bug lies in the following method of Project. Note that path.toFile().delete() is being called relying on the fact that it will not be deleted if it has contents. However this is causing the OS level write protect error dialog to appear. If I say ignore (WinNT - I get two dialogs), then the Project is successfully deleted from the workspace. /** * Deletes everything but contents. Needed for restore where we do not find * the .prj file. Also used from #delete. */ public void basicDelete(MultiStatus status) throws CoreException { // get the location first because it will be null after we delete the // project from the tree. IPath path = getLocation(); deleteResource(false, status); // Delete the contents directory for the project. Note that this is a garbage // collection action only, and the directory will not get deleted if it still // contains files. if (path != null) path.toFile().delete(); workspace.getMetaArea().delete(this); clearHistory(null); }
I could not reproduce with the CD-ROM, but I received the following steps from Randy which reproduce the bug on Win2000: 1) Create a folder with a couple files on the floppy 2) Remove the floppy and move its tab to read-only 3) Replace the floppy and create a project targeted to the floppy folder. 4) Try to delete the project, say "No" to delete content. You get an OS dialog saying the disk is write-protected. This doesn't make sense to the user because he said not to delete content.
Fixed, tested and released. Fix was to remove the call to delete() from the basicDelete method. It was only a cleanup operation to remove the directory if empty. It is more appropriate to just leave the empty directory if the caller has specified not to delete contents.