C-API Opening Files (in the simulator)

SDK: 1.12.3 on Linux

I have a custom binary file I've made, named "latin.bin". It's put into "Source/data", and I can see it get copied to the PDX ~

/home/sando/Code/Play.Date/PlaydateSDK/PlaydateSDK-1.12.3/bin/pdc -sdkpath /home/sando/Code/Play.Date/PlaydateSDK/PlaydateSDK-1.12.3 /home/sando/Code/Play.Date/Turret/Source /home/kingsley/Code/Play.Date/Turret/Turret.pdx
Unrecognized file types are copied by default. Use the -k or --skip-unknown flag to skip these files instead.
Copying data/latin.bin

And in the Turret.pdx directory, I can see the file: data/latin.bin.

But when I go to load that in my code, it always fails returning a NULL file handle, with an error message of "no such file".

SDFile *fin = playdate->file->open( glyph_files[gt], kFileReadData );
if ( fin == NULL )
    playdate->system->error( "Failed to open Keyboard File [%s], error [%s]", glyph_files[gt], playdate->file->geterr() );

So I'm always getting the message logged:

Failed to open Keyboard File [data/latin.bin], error [No such file]

I don't understand what's wrong. It looks OK to me.

For this you’ll want to use kFileRead to read out of the pdx itself.

kFileReadData is used to search the game’s “Data” folder (something like /Data/<bundleID>/ on the console’s storage).