My first (publicly available) app for Haiku

Keep in mind that in the future Haiku may have multiple users and each will have their own B_USER_DATA_DIRECTORY and B_USER_SETTINGS_DIRECTORY and others. Meanwhile the ones like B_SYSTEM_SETTINGS_DIRECTORY are global to the system, shared by all users. Similarly your app can be installed as a system app (the current default) or a per-user app (use pkgman install --home blah.hpkg). The search priority is for user specific apps first, and non-packaged before packaged within that.

But for your particular app, if your data isn’t changing much, you can include it in your .hpkg package, and use a path relative to the installed package location to find it (something like …/Data/MyApp/ off the initial current directory when your app starts). If your data is changing a lot (or has multiple languages or user contributed items) then put it in its own package and hunt for your data files as files in subdirectories in the usual 4 main directories - user-non-packaged, user, system-non-packaged, system.

See the documentation for details, and places where things could be.

1 Like

Thanks @agmsmith :+1:
I think in this case using relative paths should be sufficient. I´ll try :slight_smile:

The best approach IMO is to use BPathFinder (new API, see Haiku Book). It goes something like this:

BPathFinder pathFinder;
BPath path;
	"path/to/the/file", path, B_FIND_PATH_EXISTING_ONLY);

That’ll look into all possible locations (system/data, system/non-packaged/data, same for the home hierarchy) and fills the path with the first find.
Now you don’t have to care where the user installs your software. I’d keep the settings fixed in B_USER_SETTINGS_DIRECTORY.

1 Like

The the latest one has lots of jargon and proper names that are not used for this kind of game. The one I used in Noose does not have these, though it does have some words that are too long for your game.