WurstScript icon indicating copy to clipboard operation
WurstScript copied to clipboard

Reading files at compile time

Open DoctorRainer opened this issue 6 years ago • 2 comments

Problem

Sometimes we need to read some info from files at compile time

Solution

To add file reading possibility where we get plain text and can handle it with something like json parser. It would be useful for something like localisation or something similar like config which I can update though the internet and then load it compiletime.

And I have a couple of questions as well, I doubt that we can use HTTP request at run time, but what about reading files? I heard that its possible, we saw that save / load systems but it was said that local files don't work anymore

DoctorRainer avatar Aug 19 '19 18:08 DoctorRainer

The general problem of this is exposing unsafe things to wurst code files. It shouldn't really be possible to read any files and send them across the net imho.

But it could definitely be a useful addition in many cases, as you said, e.g. translation.

And I have a couple of questions as well, I doubt that we can use HTTP request at run time, but what about reading files? I heard that its possible, we saw that save / load systems but it was said that local files don't work anymore

Yes it was semi broken by patches, the new PR will address this though and it should work again.

Frotty avatar Oct 23 '19 09:10 Frotty

Maybe we can do 2 things:

  1. Add some kind of foreign function interface, which allows to call any Java function.
  2. Add a permission file, where every call to Java must be explicitly allowed.

I agree with Frotty that we want to keep the code sandboxed by default.

peq avatar Dec 12 '19 22:12 peq