I'm trying to load pepflashplayer.dll in Windows OS using this code:
app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname + '/lib/pepflashplayer.dll'))
The package.json file looks like this:
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "build --dir"
},
"build": {
"appId" : "cristest",
"productName" : "testing package",
"win": {
"target": "nsis",
"extraResources": "./lib/*.dll"
},
"directories": {
"buildResources": "resources",
"output": "release"
}
},
"devDependencies": {
"electron": "~1.6.2",
"electron-builder": "^19.16.0"
}
}
Running npm start will load the flash game ok:

Running npm build -w will build the app in release folder, and copy the dll file in release\win-unpacked\resources\lib folder, and running the exe file will fail to load the dll and the flash game will not work:

The folder structure looks like this:

How could i make the plugin run also in "package mode"?
Issue related to #664
app.commandLine.appendSwitch('ppapi-flash-path', path.join((__dirname.includes(".asar") ? process.resourcesPath : __dirname) + '/lib/pepflashplayer.dll'))
Because __dirname in the packed form contains postfix .asar.
@develar thanks for quick reply!
process.resourcesPath seems to be pointing to ...\electron-quick-start\node_modules\electron\dist\resources . This doesn't look right, and also the error is the same.
This doesn't look right, and also the error is the same.
As stated, it point to correct path only in the packed application. That's why we check __dirname.includes(".asar")
It's working fine. Thank you @develar!
Oh, one thing i noticed, only in packaged mode, it's opening one or two command prompt windows for about 200ms, it's noticeable.
Are you aware it's doing that? And is there any way to remove it?
I can provide a demo project for you to clone if required.
@muscaiu Not clear what do you mean :)
Look at my demo project.
This glitch is happening:
When you build the app and launch the exe, a terminal window appears for 200 miliseconds. (don't blink :D)
When you start the app with yarn start no terminal appears.
It's not the end of the world, but it has a virus feeling, if you know what i mean :-)
have you fix this glitch? @muscaiu
Nope. It doesn't seem to be an issue for my client. Working on another project now.
Most helpful comment