Convert gylphcache file
[kugel-rb.git] / firmware / export / paths.h
blobbfe94ccfe0683228272ff1c6806167736cbed5f5
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)
41 /* name of directory where configuration, fonts and other data
42 * files are stored */
43 #ifdef __PCTOOL__
44 #undef ROCKBOX_DIR
45 #undef ROCKBOX_DIR_LEN
46 #undef WPS_DIR
47 #define ROCKBOX_DIR "."
48 #define ROCKBOX_DIR_LEN 1
49 #else
51 /* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */
52 #ifndef ROCKBOX_DIR
53 #error ROCKBOX_DIR not defined (should be in autoconf.h)
54 #endif
55 #define ROCKBOX_DIR_LEN (sizeof(ROCKBOX_DIR)-1)
56 #endif /* def __PCTOOL__ */
58 #ifndef APPLICATION
60 /* make sure both are the same for native builds */
61 #undef ROCKBOX_LIBRARY_PATH
62 #define ROCKBOX_LIBRARY_PATH ROCKBOX_DIR
64 #define PLUGIN_DIR ROCKBOX_DIR "/rocks"
65 #define CODECS_DIR ROCKBOX_DIR "/codecs"
67 #define REC_BASE_DIR "/"
68 #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
70 #ifndef PLUGIN
71 static inline __attribute__((always_inline)) const char* get_user_file_path(const char *path,
72 unsigned flags,
73 char* buf,
74 const size_t bufsize)
76 if (flags & FORCE_BUFFER_COPY)
78 strlcpy(buf, path, bufsize);
79 return buf;
81 return path;
83 #endif
85 #define paths_init()
86 #else /* application */
88 #define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
89 #define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs"
91 #define REC_BASE_DIR ROCKBOX_DIR "/"
92 #define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists"
94 extern void paths_init(void);
95 extern const char* get_user_file_path(const char *path,
96 unsigned flags,
97 char* buf,
98 const size_t bufsize);
99 #endif /* APPLICATION */
101 #define LANG_DIR ROCKBOX_DIR "/langs"
103 #define PLUGIN_GAMES_DIR PLUGIN_DIR "/games"
104 #define PLUGIN_APPS_DIR PLUGIN_DIR "/apps"
105 #define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos"
106 #define VIEWERS_DIR PLUGIN_DIR "/viewers"
109 #define WPS_DIR ROCKBOX_DIR "/wps"
110 #define SBS_DIR WPS_DIR
111 #define THEME_DIR ROCKBOX_DIR "/themes"
112 #define FONT_DIR ROCKBOX_DIR "/fonts"
113 #define ICON_DIR ROCKBOX_DIR "/icons"
115 #define BACKDROP_DIR ROCKBOX_DIR "/backdrops"
116 #define EQS_DIR ROCKBOX_DIR "/eqs"
118 /* need to fix this once the application gets record/radio abilities */
119 #define RECPRESETS_DIR ROCKBOX_DIR "/recpresets"
120 #define FMPRESET_PATH ROCKBOX_DIR "/fmpresets"
122 #define VIEWERS_CONFIG ROCKBOX_DIR "/viewers.config"
123 #define CONFIGFILE ROCKBOX_DIR "/config.cfg"
124 #define FIXEDSETTINGSFILE ROCKBOX_DIR "/fixed.cfg"
126 #define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control"
127 #define NVRAM_FILE ROCKBOX_DIR "/nvram.bin"
128 #define GLYPH_CACHE_FILE ROCKBOX_DIR "/.glyphcache"
129 #endif /* __PATHS_H__ */