Community
Participate
Working Groups
Build ID: M20070921-1145 Steps To Reproduce: 1. Create empty directory in any project. 2. Export this project to archive. In wizard tree open this project node to confirm that this directory checked to copy to archive. 3. Open zip file - there is no this directory. More information: If you use external archiver, empty directories will be created
How are you opening the zip file? Winzip may not show what is created by the java zip API. If you export and then import back in again and have data loss then there is an issue
I used Total Commander. 1) I packed this project using TC, then opened it using TC. I saw empty folders. 2) I packed this project using export feature and didn't see empty directories in the archive. If you go to implementation (class ArchiveFileExportOperation, recursive method exportResource, it's getting clear why it happened: IResource[] children = null; try { children = ((IContainer) exportResource).members(); } catch (CoreException e) { // this should never happen because an #isAccessible check is done before #members is invoked addError(NLS.bind(DataTransferMessages.DataTransfer_errorExporting, exportResource.getFullPath()), e); } // AC note: for empty container children.length == 0 ! It does nothing for empty container for (int i = 0; i < children.length; i++) { exportResource(children[i], leadupDepth + 1); }
Not all zip formats are the same. it is only valid if you use something that uses the java.util.Zip on both sides.
I expect consistency from Eclipse. If I open project node (left panel in Export Wizard) , I see that empty directory is checked. That's why I expect to see it in archive.
Alex I think you misunderstand. We use the java.util.Zip API. Checking the results in a tool that doesn't may not give you a correct picture of the situation. WinZip for instance will filter out empty directories in some versions. Of course I could have saved us all of this chat by checking <grin> and indeed they are not getting imported.
Oh, its up to you, you can fix the problem or ignore it. At last, I have a workaround. I just have to mention that the idea there are utilities that do not save empty directories, and winzip is one of them, is not correct. Or maybe such program exists (definitely: Eclipse is one of them), but this is not winzip. This one saves in archive empty directories, but does not show them. However, you can see them using another viewers, and you can extract them later. See for example http://britishinside.com/archive/2007/06/18/Zip-files-and-hidden-folders.aspx : ANSWER FROM WINZIP: "The empty folder name entries are normally not displayed in the WinZip window for cosmetic reasons, but Using Microsoft's 'regedit' utility from the 'run' option of the start menu will allow you to add a key to the registry to display the foldernames in the WinZip window. Locate the Key: HKEY_CURRENT_USER\Software\Nico Mak Computing\WinZip\WinZip The 'string value' key 'ShowDirEntries' can be added, and then set to '1'; This will display the empty folder entries in the WinZip window."
*** This bug has been marked as a duplicate of bug 278402 ***