$rbdir => $temp_dir where appropriate, shadowing $rbdir with the temp dir broke wpsbu...
[kugel-rb.git] / apps / paths.h
blob25960b05822f4c9f50624c93bd7b8925ff5d5d31
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Thomas Martitz
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef __PATHS_H__
23 #define __PATHS_H__
25 #include <stdbool.h>
26 #include "autoconf.h"
27 #include "string-extra.h"
29 /* flags for get_user_file_path() */
30 /* whether you need write access to that file/dir, especially true
31 * for runtime generated files (config.cfg) */
32 #define NEED_WRITE (1<<0)
33 /* file or directory? */
34 #define IS_FILE (1<<1)
35 /* make sure the path is copied into the passed buffer (it may return
36 * the passed path directly otherwise, e.g. always on target builds) */
37 #define FORCE_BUFFER_COPY (1<<2)
39 #ifndef APPLICATION
42 /* name of directory where configuration, fonts and other data
43 * files are stored */
44 #ifdef __PCTOOL__
45 #undef ROCKBOX_DIR
46 #undef ROCKBOX_DIR_LEN
47 #undef WPS_DIR
48 #define ROCKBOX_DIR "."
49 #define ROCKBOX_DIR_LEN 1
50 #else
52 /* make sure both are the same for native builds */
53 #undef ROCKBOX_LIBRARY_PATH
54 #define ROCKBOX_LIBRARY_PATH ROCKBOX_DIR
56 /* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */
57 #ifndef ROCKBOX_DIR
58 #error ROCKBOX_DIR not defined (should be in autoconf.h)
59 #endif
60 #define ROCKBOX_DIR_LEN sizeof(ROCKBOX_DIR)
61 #endif /* def __PCTOOL__ */
63 #define PLUGIN_DIR ROCKBOX_DIR "/rocks"
64 #define CODECS_DIR ROCKBOX_DIR "/codecs"
65 #define LANG_DIR ROCKBOX_DIR "/langs"
67 #define REC_BASE_DIR "/"
68 #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
71 static inline const char* get_user_file_path(const char *path,
72 unsigned flags,
73 char* buf,
74 const size_t bufsize)
75 ,unused));
77 #ifndef PLUGIN
78 static inline __attribute__((always_inline)) const char* get_user_file_path(const char *path,
79 unsigned flags,
80 char* buf,
81 const size_t bufsize)
83 if (flags & FORCE_BUFFER_COPY)
85 strlcpy(buf, path, bufsize);
87 return buf;
89 return path;
91 #endif
93 #define paths_init()
94 #else /* application */
96 #define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
97 #define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs"
98 #define LANG_DIR ROCKBOX_LIBRARY_PATH "/rockbox/langs"
100 #define REC_BASE_DIR ROCKBOX_DIR "/"
101 #define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists"
103 extern void paths_init(void);
104 extern const char* get_user_file_path(const char *path,
105 unsigned flags,
106 char* buf,
107 const size_t bufsize);
108 #endif /* APPLICATION */
111 #define PLUGIN_GAMES_DIR PLUGIN_DIR "/games"
112 #define PLUGIN_APPS_DIR PLUGIN_DIR "/apps"
113 #define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos"
114 #define VIEWERS_DIR PLUGIN_DIR "/viewers"
117 #define WPS_DIR ROCKBOX_DIR "/wps"
118 #define SBS_DIR WPS_DIR
119 #define THEME_DIR ROCKBOX_DIR "/themes"
120 #define FONT_DIR ROCKBOX_DIR "/fonts"
121 #define ICON_DIR ROCKBOX_DIR "/icons"
123 #define BACKDROP_DIR ROCKBOX_DIR "/backdrops"
124 #define EQS_DIR ROCKBOX_DIR "/eqs"
125 #define RECPRESETS_DIR ROCKBOX_DIR "/recpresets"
126 #define FMPRESET_PATH ROCKBOX_DIR "/fmpresets"
128 #define VIEWERS_CONFIG ROCKBOX_DIR "/viewers.config"
129 #define CONFIGFILE ROCKBOX_DIR "/config.cfg"
130 #define FIXEDSETTINGSFILE ROCKBOX_DIR "/fixed.cfg"
132 #define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control"
133 #define NVRAM_FILE ROCKBOX_DIR "/nvram.bin"
134 #endif /* __PATHS_H__ */