common/scripts/install-run.js
function ensureAndJoinPath(baseFolder, ...pathSegments) {
    let joinedPath = baseFolder;
    try {
        for (let pathSegment of pathSegments) {
            pathSegment = pathSegment.replace(/[\\\/]/g, '+');
            joinedPath = path.join(joinedPath, pathSegment);
            if (!fs.existsSync(joinedPath)) {
                fs.mkdirSync(joinedPath);
            }
        }
    }
    catch (e) {
        throw new Error(`Error building local installation folder (${path.join(baseFolder, ...pathSegments)}): ${e}`);
    }
    return joinedPath;
}
function ensureAndJoinPath(baseFolder, ...pathSegments) {
    let joinedPath = baseFolder;
    try {
        for (let pathSegment of pathSegments) {
            pathSegment = pathSegment.replace(/[\\\/]/g, '+');
            joinedPath = path.join(joinedPath, pathSegment);
            if (!fs.existsSync(joinedPath)) {
                fs.mkdirSync(joinedPath);
            }
        }
    }
    catch (e) {
        throw new Error(`Error building local installation folder (${path.join(baseFolder, ...pathSegments)}): ${e}`);
    }
    return joinedPath;
}
function ensureAndJoinPath ( baseFolder , ... pathSegments ) { let joinedPath = baseFolder ; try { for ( let pathSegment of pathSegments ) { pathSegment = pathSegment . replace ( / [\\\/] / g , '+' ) ; joinedPath = path . join ( joinedPath , pathSegment ) ; if ( ! fs . existsSync ( joinedPath ) ) { fs . mkdirSync ( joinedPath ) ; } } } catch ( e ) { throw new Error ( ` ${ path . join ( baseFolder , ... pathSegments ) } ${ e } ` ) ; } return joinedPath ; }
Create missing directories under the specified base directory, and return the resolved directory.

Does not support "." or ".." path segments.
Assumes the baseFolder exists.
Create missing directories under the specified base directory and return the resolved directory .