Edit launches scripts in the wrong directory
SquidDev opened this issue ยท 3 comments
When using the "Run" option from edit
, we save to a file called /.temp
and run it:
Historically this was fine, but is more problematic now that require
exists. As the package path relies on the directory the program is stored in, packages may not be found.
There's a couple of possible solutions to this:
- Save the file in the script's directory iff the directory isn't read only.
- Write a bootstrap script which then loads the program and uses
cc.require
to bootstrap a new package environment.
Neither are going to be perfect - ideally we'd even be able to fake getRunningProgram
, but they might work. Ideas welcome!
In L.47f it modifies the shell in the environment to return the correct value for
shell.getRunningProgram
I imagine something similar would work for this as well.
OK, that's horrific.
Neither are going to be perfect - ideally we'd even be able to fake getRunningProgram, but they might work. Ideas welcome!
It might be worth taking a look at how trace deals with this stuff, in L.47f it modifies the shell in the environment to return the correct value for shell.getRunningProgram
I imagine something similar would work for this as well.
Although, since multishell is unable to launch a function directly, we'd still need to write to a .temp file with some sort of wrapper around it.