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