function installHelper()

in lib/plugman/pluginHandlers.js [241:280]


function installHelper (type, obj, plugin_dir, project_dir, plugin_id, options, project) {
    const srcFile = path.resolve(plugin_dir, obj.src);
    const targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || '');
    const destFile = path.join(targetDir, path.basename(obj.src));

    let project_ref;
    const link = !!(options && options.link);
    if (link) {
        const trueSrc = fs.realpathSync(srcFile);
        // Create a symlink in the expected place, so that uninstall can use it.
        if (options && options.force) {
            copyFile(plugin_dir, trueSrc, project_dir, destFile, link);
        } else {
            copyNewFile(plugin_dir, trueSrc, project_dir, destFile, link);
        }
        // Xcode won't save changes to a file if there is a symlink involved.
        // Make the Xcode reference the file directly.
        // Note: Can't use path.join() here since it collapses 'Plugins/..', and xcode
        // library special-cases Plugins/ prefix.
        project_ref = `Plugins/${fixPathSep(path.relative(fs.realpathSync(project.plugins_dir), trueSrc))}`;
    } else {
        if (options && options.force) {
            copyFile(plugin_dir, srcFile, project_dir, destFile, link);
        } else {
            copyNewFile(plugin_dir, srcFile, project_dir, destFile, link);
        }
        project_ref = `Plugins/${fixPathSep(path.relative(project.plugins_dir, destFile))}`;
    }

    if (type === 'header-file') {
        project.xcode.addHeaderFile(project_ref);
    } else if (obj.framework) {
        const opt = { weak: obj.weak };
        const project_relative = path.join(path.basename(project.xcode_path), project_ref);
        project.xcode.addFramework(project_relative, opt);
        project.xcode.addToLibrarySearchPaths({ path: project_ref });
    } else {
        project.xcode.addSourceFile(project_ref, obj.compilerFlags ? { compilerFlags: obj.compilerFlags } : {});
    }
}