LarpixClient/electron/node_modules/app-builder-lib/out/util/envPath.js
olcxja fb6c8b6ee9
All checks were successful
Android Build / publish (push) Successful in 55s
Linux Build / publish (push) Successful in 1m6s
update electron to v43
2026-07-09 22:38:33 +02:00

28 lines
No EOL
1.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateEnvValue = validateEnvValue;
exports.resolveEnvToolsetPath = resolveEnvToolsetPath;
const builder_util_1 = require("builder-util");
const path = require("path");
function validateEnvValue(envVarName) {
const rawValue = process.env[envVarName];
if ((0, builder_util_1.isEmptyOrSpaces)(rawValue)) {
return null;
}
const trimmed = rawValue.trim();
// On Windows, backslash is the native path separator and must not be rejected
const shellUnsafeChars = process.platform === "win32" ? /[;&|`$<>"']/ : /[;&|`$<>"'\\]/;
if (shellUnsafeChars.test(trimmed)) {
throw new Error(`${envVarName} contains shell-unsafe characters: ${trimmed}`);
}
return trimmed;
}
function resolveEnvToolsetPath(envVarKey) {
const value = validateEnvValue(envVarKey);
if (value == null) {
return null;
}
builder_util_1.log.info({ envVarKey, value }, `resolved value from environment variable`);
return path.resolve(value);
}
//# sourceMappingURL=envPath.js.map