Yes, you need a PResource property of some sort.
While the simplest thing is just @P(1) PResource file; it's better to
use Property for this and handle the fact it might not be set. eg. in
a core:custom in a data patch -
```
@P(1) @Type(PResource.class)
Property res;
@P(2) @ReadOnly
String loc;
@Override
public void init() {
res.valuesAs(PResource::from).link(r -> {
loc = r.map(PResource::toString).orElse("");
// loc = r.map(rr ->
rr.resolve(getLookup()).get(0).toString()).orElse("");
}
);
}
```
The commented out line is necessary if your project might run across
multiple computers - resolve gives you a list of possible URIs to try
loading from - if it's always a local file it isn't necessary.
You can also look at the attached custom component, to be added to a
generic data patch, which will listen on a file for changes and
automatically load the text and send from the output.
Hope that helps.
Best wishes,
Neil
--
Neil C Smith
Artist & Technologist
www.neilcsmith.net
PraxisLIVE - hybrid visual live programming
for creatives, for programmers, for students, for tinkerers
www.praxislive.org