|
1 function run_test() { |
|
2 var testBundle = do_get_file("data/test_bug446708"); |
|
3 |
|
4 RecursivelyZipDirectory(testBundle); |
|
5 } |
|
6 |
|
7 // Add |file| to the zip. |path| is the current path for the file. |
|
8 function AddToZip(zipWriter, path, file) |
|
9 { |
|
10 var currentPath = path + file.leafName; |
|
11 |
|
12 if (file.isDirectory()) { |
|
13 currentPath += "/"; |
|
14 } |
|
15 |
|
16 // THIS IS WHERE THE ERROR OCCURS, FOR THE FILE "st14-1.tiff" IN "test_bug446708" |
|
17 zipWriter.addEntryFile(currentPath, Ci.nsIZipWriter.COMPRESSION_DEFAULT, file, false); |
|
18 |
|
19 // if it's a dir, continue adding its contents recursively... |
|
20 if (file.isDirectory()) { |
|
21 var entries = file.QueryInterface(Components.interfaces.nsIFile).directoryEntries; |
|
22 while (entries.hasMoreElements()) { |
|
23 var entry = entries.getNext().QueryInterface(Components.interfaces.nsIFile); |
|
24 AddToZip(zipWriter, currentPath, entry); |
|
25 } |
|
26 } |
|
27 |
|
28 // ...otherwise, we're done |
|
29 } |
|
30 |
|
31 function RecursivelyZipDirectory(bundle) |
|
32 { |
|
33 zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE); |
|
34 AddToZip(zipW, "", bundle); |
|
35 zipW.close(); |
|
36 } |
|
37 |