Skip to content

additional program data directory

pcercuei edited this page Apr 13, 2013 · 9 revisions

This page tries to gather ideas about solving the additional program data directory problem.

For many reasons some programs might require to read additional data files which cannot be bundled with the .opk file. These reasons might be due to copyright, or simply to support user created content, mods, etc.

To make it easier for the users, the additional data path should not use the $HOME/.app_name/ directory. There are several reasons for that:

  • $HOME directory is hidden deep in the filesystem. It makes it hard for newcomers and people unfamiliar with UNIX filesystem structure to navigate through the directory tree
  • the $HOME/.app_name/ convention makes this directory hidden, so many FTP clients will not show it and it might be necessary to manually cd into this directory
  • $HOME usually points to the internal card, while the additional data directory should be located on the same memory card the .opk file of the program is

The following approaches to solving this issue were proposed:

Zear's approach

  • introduce $OPK_DIR environment variable - pointing to the directory location of the .opk file (usually */apps/)
  • additional data files should be put to $OPK_DIR/data/app_name/, example: $OPK_DIR/data/freedoom/
  • this makes the data directory independent from the filesystem structure changes - the user can always expect to put the data inside the directory where he keeps the .opk files

Johnnyonflame's / pcercuei's approach

  • introduce an environment variable named $DATADIR (as a more generic name than $OPK_DIR)
  • add in the OPK's metadata a config key that instructs the application selection menu whether or not the application needs separate data.
  • have the application selection menu set $DATADIR before launching the OPK, setting it to the path previously requested by the user
  • if starting the application for the first time, or selecting the corresponding option on the contextual menu, open a directory selector and ask the user to point to the data files; memorize the path on the menu's local config.

Clone this wiki locally