Merge pull request #3881 from dloverin/read-dir-fix

fix reading files under the root tern director more than once
This commit is contained in:
Erik Tierney committed 2013-05-17 08:36:00 -07:00
commit ded2de1385
1 file changed
+6 -5
@@ -267,8 +267,7 @@ define(function (require, exports, module) {
* Add the files in the directory and subdirectories of a given directory
* to tern.
*
* @param {string} dir - the directory to add
* be included.
* @param {string} dir - the root directory to add.
* @param {function ()} doneCallback - called when all files have been
* added to tern.
*/
@@ -280,8 +279,7 @@ define(function (require, exports, module) {
* Add the files in the directory and subdirectories of a given directory
* to tern, excluding the rootTernDir).
*
* @param {string} dir - the directory to add
* be included.
* @param {string} dir - the root directory to add.
* @param {function()} successCallback - callback when
* done processing files.
*/
@@ -335,6 +333,7 @@ define(function (require, exports, module) {
}
}
dir = FileUtils.canonicalizeFolderPath(dir);
forEachFileInDirectory(dir, doneCallback, fileCallback, directoryCallback);
}
@@ -877,7 +876,9 @@ define(function (require, exports, module) {
addAllFilesAndSubdirectories(dir, function () {
// If the file is in the project root, then read
// all the files under the project root.
if (projectRoot && (dir + "/").indexOf(projectRoot) === 0) {
var currentDir = (dir + "/");
if (projectRoot && currentDir !== projectRoot &&
currentDir.indexOf(projectRoot) === 0) {
addAllFilesAndSubdirectories(projectRoot, function () {
// prime the pump again but this time don't wait
// for completion.