Bug 1391576 - Stop doing main-thread I/O in FileUtils.getFile for the most common case. r=kmag
MozReview-Commit-ID: HybmKdeReeX
--- a/toolkit/modules/FileUtils.jsm
+++ b/toolkit/modules/FileUtils.jsm
@@ -31,20 +31,21 @@ this.FileUtils = {
* @param key
* The Directory Service Key to start from
* @param pathArray
* An array of path components to locate beneath the directory
* specified by |key|. The last item in this array must be the
* leaf name of a file.
* @return nsIFile object for the file specified. The file is NOT created
* if it does not exist, however all required directories along
- * the way are.
+ * the way are if pathArray has more than one item.
*/
getFile: function FileUtils_getFile(key, pathArray, followLinks) {
- var file = this.getDir(key, pathArray.slice(0, -1), true, followLinks);
+ var file = this.getDir(key, pathArray.slice(0, -1), pathArray.length > 1,
+ followLinks);
file.append(pathArray[pathArray.length - 1]);
return file;
},
/**
* Gets a directory at the specified hierarchy under a nsIDirectoryService
* key.
* @param key