"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "assertConsistentPathCasing", {
    enumerable: true,
    get: function() {
        return assertConsistentPathCasing;
    }
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
function assertConsistentPathCasing() {
    if (process.platform !== 'win32') return;
    for (const [label, given] of [
        [
            'cwd',
            process.cwd()
        ],
        [
            'script directory',
            __dirname
        ]
    ]){
        let canonical;
        try {
            canonical = _fs.default.realpathSync.native(given);
        } catch  {
            continue;
        }
        if (canonical !== given) {
            // eslint-disable-next-line no-console
            console.error([
                '',
                'FATAL: install path casing mismatch',
                `  ${label}:`,
                `    given:     ${given}`,
                `    canonical: ${canonical}`,
                '',
                "Node's require.cache is case-sensitive on Windows, so launching from a",
                'non-canonical casing loads modules twice and silently breaks `instanceof`',
                'checks across the duplicates. Re-launch using the canonical casing.',
                ''
            ].join('\n'));
            process.exit(1);
        }
    }
}

//# sourceMappingURL=assertConsistentPathCasing.js.map