Merge branch 'master' of git://git.openpandora.org/pandora-libraries
[pandora-libraries.git] / include / pnd_apps.h
1
2 #ifndef h_pnd_apps_h
3 #define h_pnd_apps_h
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 // default application searchpath (and key to look it up in config)
10 #define PND_APPS_SEARCHPATH "/media/*/pandora/apps:/usr/pandora/apps"
11 #define PND_APPS_KEY "autodiscovery.searchpath"
12
13 // default notify searchpath (and key to look it up in config)
14 #define PND_APPS_NOTIFYPATH "/media:/media/*/pandora/apps:/usr/pandora/apps"
15 #define PND_APPS_NOTIFY_KEY "autodiscovery.notifypath"
16
17 #define PND_PNDRUN_SEARCHPATH_KEY "pnd.searchpath"
18 #define PND_PNDRUN_KEY "pnd.runscript"
19 #define PND_PNDRUN_FILENAME "pnd_run.sh"
20 #define PND_PNDRUN_DEFAULT "/usr/pandora/scripts/pnd_run.sh"
21
22 #define PND_PXML_OVERRIDE_SEARCHPATH "~/pxml-overrides"
23 #define PND_PXML_OVERRIDE_KEY "overrides.searchpath"
24
25 #define PND_MOUNT_PATH "/mnt/pnd/" /* all mounted PND images should be here.. /mnt/apps/UNIQUE-ID/... */
26
27 // .desktop support
28 #define PND_DOTDESKTOP_KEY "dotfiles.dotdesktoppath"
29 #define PND_DOTDESKTOPICONS_KEY "dotfiles.iconpath"
30 #define PND_DOTDESKTOP_DEFAULT "~/.applications"
31 #define PND_DOTDESKTOPICONS_DEFAULT "~/.applications"
32
33 // apps
34 #define PND_DEFAULT_WORKDIR "./"
35
36 /* pnd_apps_exec() is used to blindly launch an app, be it a .pnd file bundle or a plain executable
37  * (shell, bin, whatever.) pndrun specifies the full path to the pnd_run sh script, which should be
38  * found using searchpaths and locates.. see locatetest.c for a sample
39  * pnd_run, fullpath, unique_id, rel_exec required
40  * rel_startdir, clockspeed, options are optional
41  * NOTE: Use pnd_locate function to locate the pnd_run, for example
42  * NOTE: if specified, clock speed will be set prior to invoking the script, and set back on exit
43  * NOTE: No values can be except clockspeed; a 0 clockspeed means 'leave alone'. Set startdoir to "." instead of NULL.
44  * fork() is implied; calling this function does not kill this process :)
45  * NOTE: PAss in the full path to the awesomeapp.pnd or to the directory containing PXML.xml (not the PXML.xml itself.)
46  * Options is a set of boolean flags, derived from the #define's below; OR them together.
47  *   option-block, when set, suggests the launch should wait until the invoked application exits (disregarding why app exits)
48  *   example: options = PND_EXEC_OPTION_BLOCK | PND_EXEC_OPTION_2;
49  */
50 #define PND_EXEC_OPTION_NIL        0
51 #define PND_EXEC_OPTION_BLOCK      1 /* wait till children complete; note, children might fork on their own.. */
52 #define PND_EXEC_OPTION_NOUNION    2 /* request pnd_run not use a union, just do the mount/run */
53 #define PND_EXEC_OPTION_NOX11      4 /* request pnd_run to kill x11 and restart it after */
54 #define PND_EXEC_OPTION_FUTURE2    8
55
56 unsigned char pnd_apps_exec ( char *pndrun, char *fullpath, char *unique_id,
57                               char *rel_exec, char *rel_startdir,
58                               unsigned int clockspeed, unsigned int options );
59
60 // should you wish to know where an app will get mounted, call this function to obtain a guess. The
61 // logic is wrapped up in pnd_run.sh, but in theory should be easily determined.
62
63 // get_appdata_path() is the one you probably want.. the appdata path (which includes both the
64 // files in the pnd, and any files updated/written-out from that app. Look up aufs or union-filesystems.)
65 // ie: appdata path is read/write, while ro_mountpoint is read-only
66 // Returns >0 on success, and if not-NULL will fill r_path (up to path_len length.)
67 unsigned char pnd_get_appdata_path ( char *fullpath, char *unique_id, char *r_path, unsigned int path_len );
68 // get_ro_mountpoint() returns the _read only_ mountpoint, where the dir or .pnd is actually
69 // mounted to. This is probably NOT WHAT YOU WANT. You probably want the read/write mountpoint, which
70 // is the union-filesystem version of it.. see pnd_get_appdata_path()
71 //   r_mountpoint (if !NULL) will be populated; mountpoint_len should specify the maxlen of the buffer
72 void pnd_get_ro_mountpoint ( char *fullpath, char *unique_id, char *r_mountpoint, unsigned int mountpoint_len );
73
74 #ifdef __cplusplus
75 } /* "C" */
76 #endif
77
78 #endif