2022-04-02 21:23:19 +00:00
|
|
|
// Custom requireNative as Electron >=17 breaks Module.globalPaths for some reason
|
2022-04-03 21:17:29 +00:00
|
|
|
// For Updater v2: get direct path in globalPaths (g[0])
|
2022-04-02 21:23:19 +00:00
|
|
|
// For Module Updater: get root path for all modules in globalPaths
|
|
|
|
|
|
|
|
const g = require('module').globalPaths;
|
2022-04-07 15:04:05 +00:00
|
|
|
module.exports = (n, e = '') => require(require('path').join(g.reverse().find(x => x.includes(n)) ?? g[0], n, e));
|