mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Make process.dlopen work for asar packages.
This commit is contained in:
@@ -220,3 +220,16 @@ fs.readdirSync = (p) ->
|
||||
throw createNotFoundError(asarPath, filePath) unless 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
|
||||
|
||||
Reference in New Issue
Block a user