|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/licenses/publicdomain/ */ |
|
3 |
|
4 function run_test() { |
|
5 var nsILocalFile = Components.interfaces.nsILocalFile; |
|
6 var root = Components.classes["@mozilla.org/file/local;1"]. |
|
7 createInstance(nsILocalFile); |
|
8 |
|
9 // copied from http://mxr.mozilla.org/mozilla-central/source/image/test/unit/test_imgtools.js#135 |
|
10 // nsIXULRuntime.OS doesn't seem to be available in xpcshell, so we'll use |
|
11 // this as a kludgy way to figure out if we're running on Windows. |
|
12 var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes); |
|
13 if (isWindows) { |
|
14 root.initWithPath("\\\\."); |
|
15 } else { |
|
16 return; // XXX disabled, since this causes intermittent failures on Mac (bug 481369). |
|
17 root.initWithPath("/"); |
|
18 } |
|
19 var drives = root.directoryEntries; |
|
20 do_check_true(drives.hasMoreElements()); |
|
21 while (drives.hasMoreElements()) { |
|
22 var newPath = drives.getNext().QueryInterface(nsILocalFile).path; |
|
23 do_check_eq(newPath.indexOf("\0"), -1); |
|
24 } |
|
25 } |