function isCordova()

in src/CordovaCheck.js [41:75]


function isCordova (dir) {
    if (!dir) {
        // Prefer PWD over cwd so that symlinked dirs within your PWD work correctly (CB-5687).
        const pwd = process.env.PWD;
        const cwd = process.cwd();
        const hasPwd = pwd && pwd !== cwd && pwd !== 'undefined';

        return (hasPwd && isCordova(pwd)) || isCordova(cwd);
    }

    let bestReturnValueSoFar = false;

    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;
    }

    console.error('Hit an unhandled case in CordovaCheck.isCordova');
    return false;
}