main: do not error out with CJS
This commit is contained in:
parent
2a6dcaad6d
commit
e0858a12fa
@ -238,7 +238,11 @@ const startBrowser = async (url, parentDir, { allowHTTP = false, allowNavigation
|
||||
};
|
||||
|
||||
// get parent directory of where function was called from
|
||||
const getParentDir = () => dirname(fileURLToPath((new Error()).stack.split('\n')[3].slice(7).trim().split(':').slice(0, -2).join(':')));
|
||||
const getParentDir = () => {
|
||||
let place = (new Error()).stack.split('\n')[3].slice(7).trim().split(':').slice(0, -2).join(':');
|
||||
if (place.startsWith('file://')) place = fileURLToPath(place);
|
||||
return dirname(place);
|
||||
};
|
||||
|
||||
const checkForDangerousOptions = ({ allowHTTP, allowNavigation }) => {
|
||||
if (allowHTTP === true) dangerousAPI('Gluon.open', 'allowHTTP', 'true');
|
||||
|
Loading…
x
Reference in New Issue
Block a user