Hello,
My code runs with out errors on W10 and Processing 4.4.4 and can extract the file name (see array contents) but was not used to set the title.
A bit of work and this can be used to set the title.
My focus was on your approach with your last code example on my system.
I see there are alternative solutions!
I may very well be the issues with the slashes which can be OS dependent:
- Backslash vs Forward Slash: Key Differences in Grammar and File Paths – WP Maintenance
- JavaFX GIF Player Discussion
This is working here:
String filename = directories[directories.length-1];
surface.setTitle(filename); // Sets title to the name of file
Working means no errors and sets title for example provided (with additional edits) on my Windows 10 and Processing 4.4.4 setup.
It may still need work!
Lots to read in this topic and I will likely explore this in depth later.
:)