Include trailing separator in comparisons
This commit is contained in:
parent
c6906deef2
commit
905e9e9645
1 changed files with 3 additions and 2 deletions
|
@ -12,10 +12,11 @@ module.parent.paths = []
|
||||||
const originalNodeModulePaths = Module._nodeModulePaths
|
const originalNodeModulePaths = Module._nodeModulePaths
|
||||||
Module._nodeModulePaths = function (from) {
|
Module._nodeModulePaths = function (from) {
|
||||||
const paths = originalNodeModulePaths(from)
|
const paths = originalNodeModulePaths(from)
|
||||||
const rootPath = process.resourcesPath
|
|
||||||
|
|
||||||
// If "from" is outside the app then we do nothing.
|
// If "from" is outside the app then we do nothing.
|
||||||
const skipOutsidePaths = path.resolve(from).startsWith(rootPath)
|
const rootPath = process.resourcesPath + path.sep
|
||||||
|
const fromPath = path.resolve(from) + path.sep
|
||||||
|
const skipOutsidePaths = fromPath.startsWith(rootPath)
|
||||||
if (skipOutsidePaths) {
|
if (skipOutsidePaths) {
|
||||||
return paths.filter(function (candidate) {
|
return paths.filter(function (candidate) {
|
||||||
return candidate.startsWith(rootPath)
|
return candidate.startsWith(rootPath)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue