module.exports = function()

in src/platform.js [33:54]


module.exports = function (platform, opts) {
    // note: `this` is actually an instance of main.js CordovaServe
    // this module is a mixin
    const that = this;
    const retPromise = new Promise((resolve, reject) => {
        if (!platform) {
            reject(new Error('Error: A platform must be specified'));
        } else {
            opts = opts || {};
            const projectRoot = findProjectRoot(opts.root);
            that.projectRoot = projectRoot;
            opts.root = util.getPlatformWwwRoot(projectRoot, platform);

            if (!fs.existsSync(opts.root)) {
                reject(new Error(`Error: Project does not include the specified platform: ${platform}`));
            } else {
                return resolve(that.launchServer(opts));
            }
        }
    });
    return retPromise;
};