Checking the source code, you need to check JFileChooser and probly FileChooser’s documentation and use those libraries directly if it fits your use case requirements.
I know you posted this back in 2019, but I thought I’d add a little something to it.
I discovered it on accident. If you add “…:” to dataFile(.txt); as in
`selectInput(“Select a file to process:”, “fileSelected”, dataFile(" …:.txt")); (2 or 3 dots/periods and a colon)
the next time you use selectInput(), it will start the folder you last used. I don’t know why this works. I can’t find any information about it, but it works
In my experience it will always start the folder you last used (not only with your trick) - which is a bug because it should use the folder you tell it to use.
For me, selectInput(“Select a file to process:”, “fileSelected”, dataFile(" * .txt")), always defaulted to the sketch data folder each time it was called. Granted, I can hard code a default folder, but that may not work for everyone nor every sketch. For instance, choosing a music folder. I discovered this while making a video for my YT channel “Mark Loves Coding” I’ve been coding a random music player based on a question I responded to on this forum. As the sketch evolves I eventually started using the selectInput() function. That is when I started to try to figure out why that function would not remember the last folder I was looking in. As a windows user I noticed that some apps do remember the last folder you were in and some don’t. But not Processing sketches using the selectInput() function. That said, rather than call it a bug, just add what I discovered to the documentation. I mean, why not, it works. Cheers