Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron packaging with --asar argument #36

Closed
PedroMordeP opened this issue Oct 16, 2017 · 3 comments
Closed

Electron packaging with --asar argument #36

PedroMordeP opened this issue Oct 16, 2017 · 3 comments

Comments

@PedroMordeP
Copy link

PedroMordeP commented Oct 16, 2017

Hi,
I think this is not an issue of the node-powershell but a limitation.

I have packaged my electron application with electron-packager with parameter --asar . (If I don't use asar argument it works.)
When using the app, I'm unable to execute PowerShell scripts because all the files are inside an app.asar file.
I already use the path variable like
ps.addCommand(path.join(__dirname, "/scripts/testing.ps1"), [ ....... ]);

I think I know the answer but Is it possible to use scripts inside that file?
Anyone know any alternative to hide the scripts?

Console Error
[MYPATH]\resources\app.asar\scripts\testing.ps1 is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

@BenjaminMichael
Copy link

BenjaminMichael commented Jan 21, 2018

Though asar archives are treated as directories, there are no actual directories in the filesystem, so you can never set the working directory to directories in asar archives.
source: https://electronjs.org/docs/tutorial/application-packaging

So perhaps what you can do is make an asar that doesnt include your external scripts and then you zip it all up in 7-Zip?

@PedroMordeP
Copy link
Author

PedroMordeP commented Jan 21, 2018

That was my solution when I post the questions, i was hopping someone had done something different. I exclude the scripts folder and all the working files associated with their execution.
Thank you for the reply.

@BenjaminMichael
Copy link

One other suggestion is you can make the powershell commands in JS and addCommand one line at a time so yo never use external .ps1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants