Asset filenames ending in non-alpha char (before extension) work in Simulator but fail on device

Specifically I have tested filenames ending in . and ending in ? (this is the name BEFORE the usual dot and file extension).

Example?.PNG
Example..WAV

I have a bunch of dialog strings ending in "." and "?" and I tried to automate things by using those strings as filenames. This worked fine on the Simulator, but hardware crashes with attempted to index a nil value.

My workaround: for now I'm stripping that punctuation when saving the asset files, and in Lua, removing the final character from each string with string:sub(1, -2).

—— This has been "Obscure Corner Case of the Day" with your host, Morgan Adams ——

@dave any thoughts on why this might be?

Example?.PNG doesn't work because ? isn't allowed in filename on the FAT filesystem. I've filed an issue to have the simulator check for value FAT filenames, though that's pretty low priority so it's unlikely to show up any time soon.

The system doesn't like Example..WAV because we don't allow access to parent folders and my dumb logic for checking for that was looking for .. in filenames, not checking at all whether there are path separators next to it. The simulator should give you a warning there: warning: access to /Example..pdi is not allowed on the device. I'll file that too, but same caveat about priority.

1 Like

Maybe the only effort that's even worth it would be adding a link somewhere in Inside Playdate to the requirements of FAT filenames.

2 Likes

This is a good point; I will add this into the docs (though it would indeed be nice if the Simulator could detect this.)

1 Like

Hi! I also seem to have run into this issue now.
Could you give me a full list of "illegal ASCII characters"? In my case the user can actually save files with a custom filename, so I need to be careful to somehow restrict this.
Thanks!

FWIW Official MS docs suggest avoiding these:

\ / . ? *

...although I’ve seen disagreement online that maybe other characters like | : “ are bad (for FAT, not Playdate specifcially) too. I have not tested on Playdate.

So I went through all special characters that can be input with the playdate.keyboard.
For future reference, these are the ones that cause the Playdate to crash (though not the simulator!):

  • /
  • \
  • |
  • *
  • "
  • ?
  • >
  • <
  • :
  • .. <--- two consecutive periods
1 Like