Make process.dlopen work for asar packages.
This commit is contained in:
parent
05317ad81e
commit
390b804ca0
1 changed files with 13 additions and 0 deletions
|
@ -220,3 +220,16 @@ fs.readdirSync = (p) ->
|
||||||
throw createNotFoundError(asarPath, filePath) unless files
|
throw createNotFoundError(asarPath, filePath) unless files
|
||||||
|
|
||||||
files
|
files
|
||||||
|
|
||||||
|
dlopen = process.dlopen
|
||||||
|
require('module')._extensions['.node'] = process.dlopen = (module, p) ->
|
||||||
|
[isAsar, asarPath, filePath] = splitPath p
|
||||||
|
return dlopen.apply this, arguments unless isAsar
|
||||||
|
|
||||||
|
archive = getOrCreateArchive asarPath
|
||||||
|
throw new Error("Invalid package #{asarPath}") unless archive
|
||||||
|
|
||||||
|
newPath = archive.copyFileOut filePath
|
||||||
|
throw createNotFoundError(asarPath, filePath) unless newPath
|
||||||
|
|
||||||
|
dlopen module, newPath
|
||||||
|
|
Loading…
Reference in a new issue