How to pass arguments to a JXCore native application? -
How to pass arguments to a JXCore native application? -
i created nodejs application , used jxcore -native
flag produce stand lone .exe
. i'm trying run application , pass command line arguments.
it working fine nodejs app not exe
:
c:\project> node myapp.js -arg1 bla ok.
works fine. but
c:\project> jx bundle myapp.js myapp -native c:\project> myapp.exe -arg1 bla error, please provide argument arg1.
i went through documentation packaging , blog posts same. not able find how it. idea?
thanks!
it's same there minor difference compiled apps. command line below;
jx myapp.js arg1 arg2
the process arguments are;
process.argv == [ 'jx' , 'myapp.js', 'arg1', 'arg2' ]
when compile myapp.js myapp.exe, call;
myapp.exe arg1 arg2
hence process arguments be;
process.argv == [ 'myapp.exe', 'arg1', 'arg2' ]
you may utilize trick in order switch between compiled or non-compiled apps;
if(process.isembedded) process.argv.unshift(process.argv[0]);
so, compiled app, result be: [ 'myapp.exe', 'myapp.exe', 'arg1', 'arg2' ]
, arg1
, arg2
located @ same indices when run using jx
(non-compiled).
jxcore
Comments
Post a Comment