Common/shared folder

,

The idea is to have a common/shared filesystem folder where multiple applications could possibly store information, in addition to 'personal folder' of a game.

That could be useful for scenarios like shared characters information (nickname), or saves converting/reusing from previous games.

I'm personally thinking about creating small books reader app, but currently that would mean that any text file/book must be embedded in the app.

The book file could be stored in /Data/, see the datastore functions in the docs. This allows user-added content.

Thank you Matt, but the idea is shared storage, accessible between different games (with different bundleID).
Game 1 saves something about the progress, then Game 2 can read save file from Game 1 and for example use player's decisions from previous game to shape the world accordingly.

Docs describe filesystem logic the following way:

Behind the scenes, there are two directories your game has access to: the root of your app bundle (read-only), and a Data directory unique to your game (readable and writeable) where you can store your game’s saved state or other data.

and a Data directory unique to your game

It seems like data directory is unique for the game, game 1 can't read data from game 2.
At least it works this way within emulator:

playdate.datastore.write(testTable, "test-cross-write")
local testTableInDiffGame = playdate.datastore.read("test-cross-write")
-> nil

On the other hand, there is a note about simulator logic:

When running in the simulator, all Playdate file operations will happen in the SDK’s Disk/Data/(bundleID) folder. bundleID is as specified in your project’s metadata file.

Does the real device behaviour differ?

You are not permitted access to files outside of these two directories.

I was under impression that each game can only read/write it's own files

Ah! OK. I missed this.

You're correct this isn't possible right now.

1 Like