Expansion - Access AdditionalSourcecode file
-
@DanH my takeaway from this is that Engine.loadFromJSON can handle a file not being there but currentexpansion.loadDataFile cannot, and produces an error...
-
@d-healey yup, but I can't get past .loadDataFile if there's no data file
HISE doesn't seem to like it (unlike Engine.loadFromJSON)
-
@DanH Which line gives the error and what is the error?
-
@d-healey
Error:Interface:! Cant find data file {EXP::TEST}NewNumber.json
Line:
local data = e.loadDAtaFile("NewNumber.json");
-
@DanH I see the problem. I've got to go out now but I'll take a look in the HISE source when I get back in a few hours and see if there is an easy fix.
-
@d-healey ok thanks!
-
This is how
Engine.loadFromJSON
handles a missing file.And this is how
loadDataFile
handles it:So it reports an error but does it actually stop the rest of your script running? In other words, if you put
Console.print("HELLO WORLD");
on the next line does anything print to the console? -
@d-healey yeah it stops it - i.e no "Hello World"
-
@DanH Okay, I think we should make it so it behaves the same as
loadFromJSON
and leave it up to the scripting to validate the file. I'll make a pull request with this later. -
@DanH Yeah removing those lines makes it work like the other function which I think is much better behaviour. I've made a pull request and the change is also in my fork.
-
@d-healey great, so just remove the reportScriptError line?
-
@DanH Just do what I did - https://github.com/christophhart/HISE/pull/286/commits/3ebdf557839a53c2d94c123e72391b62919aa725 (the red stuff is the parts I deleted)