in src/util.js [44:72]
function cordovaProjectRoot (dir) {
if (!dir) {
// Prefer PWD over cwd so that symlinked dirs within your PWD work correctly.
const pwd = process.env.PWD;
const cwd = process.cwd();
if (pwd && pwd !== cwd && pwd !== 'undefined') {
return cordovaProjectRoot(pwd) || cordovaProjectRoot(cwd);
}
return cordovaProjectRoot(cwd);
}
let bestReturnValueSoFar = null;
for (let i = 0; i < 1000; ++i) {
const result = isRootDir(dir);
if (result === 2) {
return dir;
}
if (result === 1) {
bestReturnValueSoFar = dir;
}
const parentDir = path.normalize(path.join(dir, '..'));
// Detect fs root.
if (parentDir === dir) {
return bestReturnValueSoFar;
}
dir = parentDir;
}
return null;
}