blob: 93e43529cdb6dd387a90d052eacf8b3d56c6f36c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
function run_test() {
var tmpDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
var zipfile = do_get_file("data/test_umlaute.zip");
var testFile = tmpDir.clone();
testFile.append("test_\u00FC.txt");
if (testFile.exists()) {
testFile.remove(false);
}
var zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(
Ci.nsIZipReader
);
zipreader.open(zipfile);
var entries = zipreader.findEntries(null);
Assert.ok(entries.hasMore());
var entryName = entries.getNext();
Assert.equal(entryName, "test_\u00FC.txt");
Assert.ok(zipreader.hasEntry(entryName));
var target = tmpDir.clone();
target.append(entryName);
target.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o640); // 0640
zipreader.extract(entryName, target);
var entry = zipreader.getEntry(entryName);
Assert.ok(entry != null);
zipreader.test(entryName);
zipreader.close();
}
|