src/extensibility/node/ExtensionManagerDomain.js
function _performInstall(packagePath, installDirectory, validationResult, callback) {
    validationResult.installedTo = installDirectory;

    function fail(err) {
        _removeFailedInstallation(installDirectory);
        callback(err, null);
    }

    function finish() {
        // The status may have already been set previously (as in the
        // DISABLED case.
        if (!validationResult.installationStatus) {
            validationResult.installationStatus = Statuses.INSTALLED;
        }
        callback(null, validationResult);
    }

    fs.mkdirs(installDirectory, function (err) {
        if (err) {
            callback(err);
            return;
        }
        var sourceDir = path.join(validationResult.extractDir, validationResult.commonPrefix);

        fs.copy(sourceDir, installDirectory, function (err) {
            if (err) {
                return fail(err);
            }
            finish();
        });
    });
}
function _performInstall(packagePath, installDirectory, validationResult, callback) {
    validationResult.installedTo = installDirectory;

    function fail(err) {
        _removeFailedInstallation(installDirectory);
        callback(err, null);
    }

    function finish() {
        // The status may have already been set previously (as in the
        // DISABLED case.
        if (!validationResult.installationStatus) {
            validationResult.installationStatus = Statuses.INSTALLED;
        }
        callback(null, validationResult);
    }

    fs.mkdirs(installDirectory, function (err) {
        if (err) {
            callback(err);
            return;
        }
        var sourceDir = path.join(validationResult.extractDir, validationResult.commonPrefix);

        fs.copy(sourceDir, installDirectory, function (err) {
            if (err) {
                return fail(err);
            }
            finish();
        });
    });
}
function _performInstall ( packagePath , installDirectory , validationResult , callback ) { validationResult . installedTo = installDirectory ; function fail ( err ) { _removeFailedInstallation ( installDirectory ) ; callback ( err , null ) ; } function finish ( ) { // The status may have already been set previously (as in the // DISABLED case. if ( ! validationResult . installationStatus ) { validationResult . installationStatus = Statuses . INSTALLED ; } callback ( null , validationResult ) ; } fs . mkdirs ( installDirectory , function ( err ) { if ( err ) { callback ( err ) ; return ; } var sourceDir = path . join ( validationResult . extractDir , validationResult . commonPrefix ) ; fs . copy ( sourceDir , installDirectory , function ( err ) { if ( err ) { return fail ( err ) ; } finish ( ) ; } ) ; } ) ; }
Private function to unzip to the correct directory.

@param {string} Absolute path to the package zip file
@param {string} Absolute path to the destination directory for unzipping
@param {Object} the return value with the useful information for the client
@param {Function} callback function that is called at the end of the unzipping
Private function to unzip to the correct directory .