Hi!
I’m doing a big project using processing. I have a bunch of files containing assets, and I want to store them in
data folder/font_assets
data folder/sprite assets
etc.
But when I try to load them, everything fails. I’ve tried the following:
The file (blah, blah) is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
File path is always an existing path that contains the file I’m looking for.
¿Any suggestion on how to access the file? ¿Should I gave some permission or something? I’m using Processing IDE for Windows.
Thanks for your reply, but the threads you show do not seem to answer my question. They are all examples of either file saving or opening of files in the data folder, not subfolders of it.
I’m unsure the problem resides in dataPath() function, since the file I’m opening is not inside dataPath, but in a subfolder of it.
Here are some other failed options:
Option a:
String path=dataPath("assets_fonts")+File.separator;
FFont=loadImage(path+"nokia_font_dark_strip.png");
`/* Result: The file "C:\Users\JOSE\Documents\Processing\doorsanddrawers\data\assets_fonts\nokia_font_dark_strip.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.`
*/
Option b:
FFont=loadImage(dataPath("assets_fonts"+File.separator+"nokia_font_dark_strip.png"));
/* Result: The file "C:\Users\JOSE\Documents\Processing\doorsanddrawers\data\assets_fonts\nokia_font_dark_strip.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
*/.
Function dataPath() also accepts relative paths w/ subfolders.
If you have a subfolder called “images/” inside sketch’s folder “data/” and a filename called “nokia_font_dark_strip.png” there, you just concatenate both as 1 argument for dataPath():