mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Some fixes
This commit is contained in:
parent
cdb87792df
commit
bafa997a70
2 changed files with 20 additions and 6 deletions
|
|
@ -39,19 +39,33 @@ export function getCertsDir() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} moduleUrl
|
||||
* Resolves the directory of the calling module.
|
||||
* Falls back to __dirname when import.meta.url is unavailable (pkg CJS binary).
|
||||
* @param {string | undefined} moduleUrl
|
||||
* @returns {string}
|
||||
*/
|
||||
function resolveModuleDir(moduleUrl) {
|
||||
if (moduleUrl) {
|
||||
return path.dirname(fileURLToPath(moduleUrl));
|
||||
}
|
||||
// eslint-disable-next-line no-undef
|
||||
return __dirname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | undefined} moduleUrl
|
||||
* @param {string} fileName
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getStartupScriptSourcePath(moduleUrl, fileName) {
|
||||
return path.join(path.dirname(fileURLToPath(moduleUrl)), "startup-scripts", fileName);
|
||||
return path.join(resolveModuleDir(moduleUrl), "startup-scripts", fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} moduleUrl
|
||||
* @param {string | undefined} moduleUrl
|
||||
* @param {string} fileName
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getPathWrapperTemplatePath(moduleUrl, fileName) {
|
||||
return path.join(path.dirname(fileURLToPath(moduleUrl)), "path-wrappers", "templates", fileName);
|
||||
return path.join(resolveModuleDir(moduleUrl), "path-wrappers", "templates", fileName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue