Author: toad
Date: 2008-02-29 19:30:46 +0000 (Fri, 29 Feb 2008)
New Revision: 18261
Modified:
trunk/freenet/src/freenet/client/ArchiveManager.java
trunk/freenet/src/freenet/client/Metadata.java
Log:
Maybe fix subdirs in implicit containers
Modified: trunk/freenet/src/freenet/client/ArchiveManager.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveManager.java 2008-02-29
19:30:28 UTC (rev 18260)
+++ trunk/freenet/src/freenet/client/ArchiveManager.java 2008-02-29
19:30:46 UTC (rev 18261)
@@ -308,7 +308,7 @@
String name = (String) i.next();
addToDirectory(dir, name, "");
}
- Metadata metadata = new Metadata(dir);
+ Metadata metadata = new Metadata(dir, "");
TempStoreElement element = makeTempStoreBucket(-1);
int x = 0;
while(true) {
Modified: trunk/freenet/src/freenet/client/Metadata.java
===================================================================
--- trunk/freenet/src/freenet/client/Metadata.java 2008-02-29 19:30:28 UTC
(rev 18260)
+++ trunk/freenet/src/freenet/client/Metadata.java 2008-02-29 19:30:46 UTC
(rev 18261)
@@ -450,41 +450,11 @@
* @param dir A map of names (string) to either files (same string) or
* directories (more HashMap's)
*/
- public void addManifest(HashMap dir) {
+ Metadata(HashMap dir, String prefix) {
// Simple manifest - contains actual redirects.
// Not zip manifest, which is basically a redirect.
documentType = SIMPLE_MANIFEST;
noMIME = true;
- //mimeType = null;
- //clientMetadata = new ClientMetadata(null);
- manifestEntries = new HashMap();
- int count = 0;
- for(Iterator i = dir.keySet().iterator();i.hasNext();) {
- String key = (String) i.next();
- count++;
- Object o = dir.get(key);
- Metadata target;
- if(o instanceof String) {
- // Zip internal redirect
- target = new Metadata(ZIP_INTERNAL_REDIRECT,
key, new ClientMetadata(DefaultMIMETypes.guessMIMEType(key, false)));
- } else if(o instanceof HashMap) {
- target = new Metadata((HashMap)o);
- } else throw new IllegalArgumentException("Not String
nor HashMap: "+o);
- manifestEntries.put(key, target);
- }
- }
-
- /**
- * Create a Metadata object for an archive which does not have its own
- * metadata.
- * @param dir A map of names (string) to either files (same string) or
- * directories (more HashMap's)
- */
- Metadata(HashMap dir) {
- // Simple manifest - contains actual redirects.
- // Not zip manifest, which is basically a redirect.
- documentType = SIMPLE_MANIFEST;
- noMIME = true;
mimeType = null;
clientMetadata = new ClientMetadata(null);
manifestEntries = new HashMap();
@@ -496,9 +466,9 @@
Metadata target;
if(o instanceof String) {
// Zip internal redirect
- target = new Metadata(ZIP_INTERNAL_REDIRECT,
key, new ClientMetadata(DefaultMIMETypes.guessMIMEType(key, false)));
+ target = new Metadata(ZIP_INTERNAL_REDIRECT,
prefix+key, new ClientMetadata(DefaultMIMETypes.guessMIMEType(key, false)));
} else if(o instanceof HashMap) {
- target = new Metadata((HashMap)o);
+ target = new Metadata((HashMap)o,
prefix+key+"/");
} else throw new IllegalArgumentException("Not String
nor HashMap: "+o);
manifestEntries.put(key, target);
}