Changeset 19221 for gli


Ignore:
Timestamp:
2009-04-23T13:55:26+12:00 (15 years ago)
Author:
ak19
Message:

Correction for allowing the metadata directories of collections nested in collectiongroups to get zipped up. Ziptools now handles empty directories with a dummy file.

Location:
gli/trunk/src/org/greenstone/gatherer/remote
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/remote/ZipCollectionConfigurations.java

    r19207 r19221  
    7171            // The "metadata" directory may not exist (non-GLI collections)
    7272            String metadata_relative_path = relative_path + collection_directories[i].getName() + File.separator + "metadata";
    73             File metadata_directory = new File(collect_directory.getAbsolutePath() + File.separator + metadata_relative_path);
     73            File metadata_directory = new File(toplevel_path + File.separator + metadata_relative_path);
    7474            if (metadata_directory.exists()) {
    7575            ZipTools.addFileToZip(zos, toplevel_path, metadata_relative_path, collection_metadata_zip_filter);
  • gli/trunk/src/org/greenstone/gatherer/remote/ZipTools.java

    r13406 r19221  
    7676            addFileToZip(zos, base_directory_path, relative_file_path + File.separator + child_files[i].getName(), zip_filter);
    7777        }
     78
     79        // empty directory. Java zips don't allow empty dirs, so need to put some dummy file in there
     80        if(child_files.length == 0) {
     81            String rel_path = relative_file_path.replace('\\', '/') + File.separator + "empty";
     82            System.err.println("Zipping empty dir requires dummy file: " + rel_path);
     83            zos.putNextEntry(new ZipEntry(rel_path));
     84        }
    7885        }
    7986
Note: See TracChangeset for help on using the changeset viewer.