Closed simast closed 9 years ago
I think that passing it at compile-time means it will be hardcoded and report same values disregarding directory it is run from. What about setting argv[0] and argv[1] both to the same value - currently executing binary path? Will it satisfy your needs?
I agree that argv[1]
should be equal to currently executing binary path, but not sure if the first element argv[0]
should be equal to the same value. In node the first value is the command executing the node binary, so on Windows it could one of the following:
"c:\Program Files\nodejs\node.exe" test.js => "c:\Program Files\nodejs\node.exe"
node.exe test.js => "node.exe"
node test.js => "node"
Can you emulate something like this for maximum compatibility? Essentially setting the first value to command used to invoke the binary executable:
"c:\Program Files\Something\test.exe" => "c:\Program Files\Something\test.exe"
test.exe => "test.exe"
test => "test"
Please upgrade to enclose@0.2.2, try new variant of argv
ang give feedback.
Yes, seems to work now. Closing this issue, thanks.
A minor issue where the second array element of
process.argv
is always reported as a "fake(argv[1])" string (should be currently executing script path). Maybe as a workaround enclose could set this value to the one passed in the command-line (when compiling)?