trouble with node.script and patch search path + patcher improvement suggestion
Hi,
I'm working on a patch with some node.js scripts but as the project will grow quickly I would prefer to store those scripts in a separate subfolder. Thats a thing I was used to do a lot for other subdatas like images, json, txt files for qlist and coll.
The problem, as I want my project to be portable without using a standalone, is that those files need either to be in the search path or called explicitely. I usually managed to do that by calling a loadmess path to a thispatcher then append to filepath search 0...
...but node.js doesn't seems to like this way as it instanciate before the loadmess is called and there is no method to my knowledge to load/reload/change the script file after the instanciation.
So any solution would be welcome but something better actually come in mind... and I would like Cycling team feedback about why it hasn't been done before. I would like to suggest to add an 'include patcher subfolder in searchpath' in the patcher option. Something which would act prioritary to all other loadings and which files are prioritary when there is doubles within other search path. This would save a lot of time and would be very usefull to organise project folder in a more free way. And actually I see no downside in this but perhaps I'm misleading.
Let me know what you think about it.
Sylvain
Sounds like what a Project is meant for: a folder with a main patcher and its dependencies organized in sub-folders, either automatically, or manually (if you disable "Keep project folder organized" in the Project inspector).
EDIT: a workaround could be to spawn the [node.script] dynamically using a newdefault message to [thispatcher]
Yep project could be of some help but seems to contrainous to me, miss the freedom of simple patch folder. The spawning could be a solution but still a lot of difficulties especially when node.script have connection to other objects.
I definitely still think that a "include patcher subfolder into the searchpath" option could be a nice addition
I definitely still think that a "include patcher subfolder into the searchpath" option could be a nice addition
I think I agree!
Just thought about another workaround. Once your script is done and you want to share your patch, you could embed the script in the patch directly. [node.script] doesn't have an @embed attribute sadly, but instead you could use [node.codebox]. This way you don't even need a dependency file, but the editing process becomes worse assuming you're used to modern code editor features.