build/utils.js
function getControllerDir(isInstall) {
    // Find the js-controller location
    const possibilities = ["iobroker.js-controller", "ioBroker.js-controller"];
    let controllerPath;
    for (const pkg of possibilities) {
        try {
            const possiblePath = require.resolve(pkg);
            if (fs.existsSync(possiblePath)) {
                controllerPath = possiblePath;
                break;
            }
        }
        catch (_a) {
            /* not found */
        }
    }
    // Apparently, checking vs null/undefined may miss the odd case of controllerPath being ""
    // Thus we check for falsyness, which includes failing on an empty path
    if (!controllerPath) {
        if (!isInstall) {
            console.log("Cannot find js-controller");
            return process.exit(10);
        }
        else {
            return process.exit();
        }
    }
    // we found the controller
    return path.dirname(controllerPath);
}
function getControllerDir(isInstall) {
    // Find the js-controller location
    const possibilities = ["iobroker.js-controller", "ioBroker.js-controller"];
    let controllerPath;
    for (const pkg of possibilities) {
        try {
            const possiblePath = require.resolve(pkg);
            if (fs.existsSync(possiblePath)) {
                controllerPath = possiblePath;
                break;
            }
        }
        catch (_a) {
            /* not found */
        }
    }
    // Apparently, checking vs null/undefined may miss the odd case of controllerPath being ""
    // Thus we check for falsyness, which includes failing on an empty path
    if (!controllerPath) {
        if (!isInstall) {
            console.log("Cannot find js-controller");
            return process.exit(10);
        }
        else {
            return process.exit();
        }
    }
    // we found the controller
    return path.dirname(controllerPath);
}
function getControllerDir ( isInstall ) { // Find the js-controller location const possibilities = [ "iobroker.js-controller" , "ioBroker.js-controller" ] ; let controllerPath ; for ( const pkg of possibilities ) { try { const possiblePath = require . resolve ( pkg ) ; if ( fs . existsSync ( possiblePath ) ) { controllerPath = possiblePath ; break ; } } catch ( _a ) { /* not found */ } } // Apparently, checking vs null/undefined may miss the odd case of controllerPath being "" // Thus we check for falsyness, which includes failing on an empty path if ( ! controllerPath ) { if ( ! isInstall ) { console . log ( "Cannot find js-controller" ) ; return process . exit ( 10 ) ; } else { return process . exit ( ) ; } } // we found the controller return path . dirname ( controllerPath ) ; }
Resolves the root directory of JS-Controller and returns it or exits the process
@param isInstall Whether the adapter is run in "install" mode or if it should execute normally
Resolves the root directory of JS - Controller and returns it or exits the process