dev/platforms/ios/cordova/Api.js
function Api(platform, platformRootDir, events) {
    // 'platform' property is required as per PlatformApi spec
    this.platform = platform || 'ios';

    this.root = platformRootDir || path.resolve(__dirname, '..');
    this.events = events || ConsoleLogger.get();
    // NOTE: trick to share one EventEmitter instance across all js code
    require('cordova-common').events = this.events;

    var xcodeProjDir;
    var xcodeCordovaProj;

    try {
        xcodeProjDir = fs.readdirSync(this.root).filter( function(e) { return e.match(/\.xcodeproj$/i); })[0];
        if (!xcodeProjDir) {
            throw new CordovaError('The provided path "' + this.root + '" is not a Cordova iOS project.');
        }

        var cordovaProjName = xcodeProjDir.substring(xcodeProjDir.lastIndexOf(path.sep)+1, xcodeProjDir.indexOf('.xcodeproj'));
        xcodeCordovaProj = path.join(this.root, cordovaProjName);
    } catch(e) {
        throw new CordovaError('The provided path "'+this.root+'" is not a Cordova iOS project.');
    }

    this.locations = {
        root: this.root,
        www: path.join(this.root, 'www'),
        platformWww: path.join(this.root, 'platform_www'),
        configXml: path.join(xcodeCordovaProj, 'config.xml'),
        defaultConfigXml: path.join(this.root, 'cordova/defaults.xml'),
        pbxproj: path.join(this.root, xcodeProjDir, 'project.pbxproj'),
        xcodeProjDir: path.join(this.root, xcodeProjDir),
        xcodeCordovaProj: xcodeCordovaProj,
        // NOTE: this is required by browserify logic.
        // As per platformApi spec we return relative to template root paths here
        cordovaJs: 'bin/CordovaLib/cordova.js',
        cordovaJsSrc: 'bin/cordova-js-src'
    };
}
function Api(platform, platformRootDir, events) {
    // 'platform' property is required as per PlatformApi spec
    this.platform = platform || 'ios';

    this.root = platformRootDir || path.resolve(__dirname, '..');
    this.events = events || ConsoleLogger.get();
    // NOTE: trick to share one EventEmitter instance across all js code
    require('cordova-common').events = this.events;

    var xcodeProjDir;
    var xcodeCordovaProj;

    try {
        xcodeProjDir = fs.readdirSync(this.root).filter( function(e) { return e.match(/\.xcodeproj$/i); })[0];
        if (!xcodeProjDir) {
            throw new CordovaError('The provided path "' + this.root + '" is not a Cordova iOS project.');
        }

        var cordovaProjName = xcodeProjDir.substring(xcodeProjDir.lastIndexOf(path.sep)+1, xcodeProjDir.indexOf('.xcodeproj'));
        xcodeCordovaProj = path.join(this.root, cordovaProjName);
    } catch(e) {
        throw new CordovaError('The provided path "'+this.root+'" is not a Cordova iOS project.');
    }

    this.locations = {
        root: this.root,
        www: path.join(this.root, 'www'),
        platformWww: path.join(this.root, 'platform_www'),
        configXml: path.join(xcodeCordovaProj, 'config.xml'),
        defaultConfigXml: path.join(this.root, 'cordova/defaults.xml'),
        pbxproj: path.join(this.root, xcodeProjDir, 'project.pbxproj'),
        xcodeProjDir: path.join(this.root, xcodeProjDir),
        xcodeCordovaProj: xcodeCordovaProj,
        // NOTE: this is required by browserify logic.
        // As per platformApi spec we return relative to template root paths here
        cordovaJs: 'bin/CordovaLib/cordova.js',
        cordovaJsSrc: 'bin/cordova-js-src'
    };
}
function Api ( platform , platformRootDir , events ) { // 'platform' property is required as per PlatformApi spec this . platform = platform || 'ios' ; this . root = platformRootDir || path . resolve ( __dirname , '..' ) ; this . events = events || ConsoleLogger . get ( ) ; // NOTE: trick to share one EventEmitter instance across all js code require ( 'cordova-common' ) . events = this . events ; var xcodeProjDir ; var xcodeCordovaProj ; try { xcodeProjDir = fs . readdirSync ( this . root ) . filter ( function ( e ) { return e . match ( / \.xcodeproj$ / i ) ; } ) [ 0 ] ; if ( ! xcodeProjDir ) { throw new CordovaError ( 'The provided path "' + this . root + '" is not a Cordova iOS project.' ) ; } var cordovaProjName = xcodeProjDir . substring ( xcodeProjDir . lastIndexOf ( path . sep ) + 1 , xcodeProjDir . indexOf ( '.xcodeproj' ) ) ; xcodeCordovaProj = path . join ( this . root , cordovaProjName ) ; } catch ( e ) { throw new CordovaError ( 'The provided path "' + this . root + '" is not a Cordova iOS project.' ) ; } this . locations = { root : this . root , www : path . join ( this . root , 'www' ) , platformWww : path . join ( this . root , 'platform_www' ) , configXml : path . join ( xcodeCordovaProj , 'config.xml' ) , defaultConfigXml : path . join ( this . root , 'cordova/defaults.xml' ) , pbxproj : path . join ( this . root , xcodeProjDir , 'project.pbxproj' ) , xcodeProjDir : path . join ( this . root , xcodeProjDir ) , xcodeCordovaProj : xcodeCordovaProj , // NOTE: this is required by browserify logic. // As per platformApi spec we return relative to template root paths here cordovaJs : 'bin/CordovaLib/cordova.js' , cordovaJsSrc : 'bin/cordova-js-src' } ; }
Creates a new PlatformApi instance.

@param  {String}  [platform] Platform name, used for backward compatibility
w/ PlatformPoly (CordovaLib).
@param  {String}  [platformRootDir] Platform root location, used for backward
compatibility w/ PlatformPoly (CordovaLib).
@param {EventEmitter} [events] An EventEmitter instance that will be used for
logging purposes. If no EventEmitter provided, all events will be logged to
console
Creates a new PlatformApi instance .