Extract platform extension: index.ios.js -> ios
773005
function getPlatformExtension(file, platforms = SUPPORTED_PLATFORM_EXTS) {
  const last = file.lastIndexOf('.');
  const secondToLast = file.lastIndexOf('.', last - 1);
  if (secondToLast === -1) {
    return null;
  }
  const platform = file.substring(secondToLast + 1, last);
  return platforms.has(platform) ? platform : null;
}
350528
def get_platform():
    """'"""
    # XXX remove distutils dependency
    result = distutils.util.get_platform().replace('.', '_').replace('-', '_')
    if result == "linux_x86_64" and sys.maxsize == 2147483647:
        # pip pull request #3497
        result = "linux_i686"
    return result
424372
function getBundleIdentifier (projectObject) {
    var packageName = projectObject.getPackageName();
    var bundleIdentifier = packageName;

    var variables = packageName.match(/\$\((\w+)\)/); // match $(VARIABLE), if any
    if (variables && variables.length >= 2) {
        bundleIdentifier = projectObject.xcode.getBuildProperty(variables[1]);
    }

    return bundleIdentifier;
}
665191
function (dirname, indexpath) {
    var extensions = {js: 1},
        modules = {};

    indexpath = indexpath || path.join(dirname, 'index.js');

    // Load all exported objects into a single module.
    fs.readdirSync(dirname).forEach(function (filename) {
      var fullpath = path.join(dirname, filename),
          parts    = filename.split('.'),
          module, name;

      if (fullpath !== indexpath && extensions[parts.pop()] && '.' !== filename[0]) {
        name = parts.join('.');
        module = require(fullpath);

        // Grab the function name or module name if possible.
        if (typeof module.name === 'string') {
          name = module.name;
        }

        modules[name] = module;
      }
    });

    return modules;
  }
368469
function getIndexFile(answers) {
    const content = format(`
        import { create } from 'rung-sdk';
        import { String as Text } from 'rung-cli/dist/types';

        function render(name) {
            return <b>{ _('Hello {{name}}', { name }) }</b>;
        }

        function main(context) {
            const { name } = context.params;
            return {
                alerts: [{
                    title: _('Welcome'),
                    content: render(name),
                    resources: []
                }]
            };
        }

        const params = {
            name: {
                description: _('What is your name?'),
                type: Text
            }
        };

        export default create(main, {
            params,
            primaryKey: true,
            title: _(${JSON.stringify(answers.title)}),
            description: _(${JSON.stringify(answers.description)}),
            preview: render('Trixie')
        });
    `);

    return { filename: path.join(answers.name, 'index.js'), content };
}
578148
def platform_from_version(major, minor):
    

    v = (major, minor)
    for low, high, name in _platforms:
        if low <= v <= high:
            return name
    return None
240414
function parseConfigXml(platform) {
        var configData = {};
        parsePlatformPreferences(configData, platform);
        parseConfigFiles(configData, platform);

        return configData;
    }
603483
def fetch_version
      output = `DEVELOPER_DIR='' "#{@path}/Contents/Developer/usr/bin/xcodebuild" -version`
      return '0.0' if output.nil? || output.empty? # ¯\_(ツ)_/¯
      output.split("\n").first.split(' ')[1]
    end
593664
def fetch_platform_informations(self, callback):
        

        self._protocolVersion = -1
        self._callback = callback

        self._request_protocol_version()
300717
function init(ctx) {
  context = ctx;
  projectRoot = ctx.opts.projectRoot;
  projectName = getProjectName(ctx, projectRoot);
  iosPlatformPath = path.join(projectRoot, 'platforms', 'ios');

  var wkWebViewPluginPath = path.join(projectRoot, 'plugins', WKWEBVIEW_PLUGIN_NAME);
  isWkWebViewEngineUsed = isDirectoryExists(wkWebViewPluginPath) ? 1 : 0;
}
607924
function getPlatformSpecificConfigXml(platform) {
  var configFilePath = null;
  switch (platform) {
    case 'ios':
      {
        configFilePath = pathToIosConfigXml();
        break;
      }
    case 'android':
      {
        configFilePath = pathToAndroidConfigXml();
        break;
      }
  }

  return configFilePath;
}
908495
function() {
    return {
      compose: app.composeCore,
      project: app.name,
      opts: {
        mode: kbox.core.deps.get('mode') === 'gui' ? 'collect' : 'attach',
        services: ['cli'],
        app: app
      }
    };
  }
66831
function platform() {
    var cpus = os.cpus();
    var cpu = cpus[0];
    cpu.cores = cpus.length;
    var tmpPlatform = os.platform();
    if (/^win/.test(tmpPlatform))
        tmpPlatform = 'windows';
    else if (tmpPlatform === 'darwin' || tmpPlatform === 'freebsd')
        tmpPlatform = 'mac';
    else if (tmpPlatform === 'linux')
        tmpPlatform = 'linux';
    return {
        platform: tmpPlatform,
        arch: os.arch(),
        release: os.release(),
        hostname: os.hostname(),
        homedir: os.homedir(),
        cpu: cpu
    };
}
1226323
function hostSupports(platform) {
    var p = platforms[platform] || {},
        hostos = p.hostos || null;
    if (!hostos)
        return true;
    if (hostos.indexOf('*') >= 0)
        return true;
    if (hostos.indexOf(process.platform) >= 0)
        return true;
    return false;
}
795320
function tryParse(filePath: string, platforms: Set<string>): ?AssetPath {
  const result = parsePlatformFilePath(filePath, platforms);
  const {dirPath, baseName, platform, extension} = result;
  if (extension == null) {
    return null;
  }
  const {rootName, resolution} = parseBaseName(baseName);
  return {
    assetName: path.join(dirPath, `${rootName}.${extension}`),
    name: rootName,
    platform,
    resolution,
    type: extension,
  };
}
832443
private static String determineMacLibrary(final String library) {
    String resourceName;
    String platform = "darwin";
    String fileExtension = "dylib";
    resourceName = "/" + platform + "/" + library + "." + fileExtension;
    return resourceName;
  }
1035046
function resolveConfigFilePath(project_dir, platform, file) {
    var filepath = path.join(project_dir, file);
    var matches;


    if (file.indexOf('*') > -1 && file.indexOf('plist') > -1) {
        project_dir = path.join(project_dir);
        // handle wildcards in targets using glob.
        matches = modules.glob.sync(path.join(project_dir, '**', file));
        if (matches.length) filepath = matches[0];
        else {
            project_dir = path.join(project_dir, '..');
            // handle wildcards in targets using glob.
            matches = modules.glob.sync(path.join(project_dir, '**', file));
            if (matches.length) filepath = matches[0];
        }

        // [CB-5989] multiple Info.plist files may exist. default to $PROJECT_NAME-Info.plist
        if(matches.length > 1 && file.indexOf('-Info.plist')>-1){
            var plistName =  getIOSProjectname(project_dir)+'-Info.plist';
            for (var i=0; i < matches.length; i++) {
                if(matches[i].indexOf(plistName) > -1){
                    filepath = matches[i];
                    break;
                }
            }
        }
        return filepath;
    }else if (platform === 'ios' && (file != 'config.xml' || file != 'JudpluginConfig.xml')){
        return filepath = path.join(project_dir, getIOSProjectname(project_dir), file);
    }

    // special-case config.xml target that is just "config.xml". This should be resolved to the real location of the file.
    // TODO: move the logic that contains the locations of config.xml from cordova CLI into plugman.
    if (file == 'config.xml') {
        if (platform == 'ubuntu') {
            filepath = path.join(project_dir, 'config.xml');
        } else if (platform == 'ios') {
            var iospath = getIOSProjectname(project_dir);
            filepath = path.join(project_dir,iospath, 'config.xml');
        } else if (platform == 'android') {
            filepath = path.join(project_dir, 'res', 'xml', 'config.xml');
        } else {
            matches = modules.glob.sync(path.join(project_dir, '**', 'config.xml'));
            if (matches.length) filepath = matches[0];
        }
        return filepath;
    }

    // XXX this checks for android studio projects
    // only if none of the options above are satisfied does this get called
    if(platform === 'android' && !fs.existsSync(filepath)) {
      // JUD_HOOK_START
      if (file === 'AndroidManifest.xml') {
          filepath = path.join(project_dir, 'judplugin', 'src', 'main', 'AndroidManifest.xml');
      } else {
          filepath = path.join(project_dir, 'judplugin', 'src', 'main', 'res', 'xml', 'config.xml');
      }
      // JUD_HOOK_END
    }

    // None of the special cases matched, returning project_dir/file.
    return filepath;
}