diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-08-01 16:15:27 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-08-01 16:15:27 +0000 |
commit | 9c0b2479f7025a84444adf08e3be8ced60dad013 (patch) | |
tree | f3d328dd73f46d599f0432cc43ae206798cbe4f6 /apps/playlist.c | |
parent | 2e7d92fef707a2cd30820fd0053c539c3ac8e2b3 (diff) | |
download | rockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.tar.gz rockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.zip |
Rockbox as an application: add get_user_file_path().
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox).
This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local.
On the DAPs it's a no-op, returing /.rockbox directly.
Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 4a6db883f7..2896f62e76 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -86,6 +86,7 @@ | |||
86 | #include "screens.h" | 86 | #include "screens.h" |
87 | #include "buffer.h" | 87 | #include "buffer.h" |
88 | #include "misc.h" | 88 | #include "misc.h" |
89 | #include "filefuncs.h" | ||
89 | #include "button.h" | 90 | #include "button.h" |
90 | #include "filetree.h" | 91 | #include "filetree.h" |
91 | #include "abrepeat.h" | 92 | #include "abrepeat.h" |
@@ -103,7 +104,6 @@ | |||
103 | #include "rbunicode.h" | 104 | #include "rbunicode.h" |
104 | #include "root_menu.h" | 105 | #include "root_menu.h" |
105 | 106 | ||
106 | #define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control" | ||
107 | #define PLAYLIST_CONTROL_FILE_VERSION 2 | 107 | #define PLAYLIST_CONTROL_FILE_VERSION 2 |
108 | 108 | ||
109 | /* | 109 | /* |
@@ -1440,7 +1440,12 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion) | |||
1440 | /* process random folder advance */ | 1440 | /* process random folder advance */ |
1441 | if (global_settings.next_folder == FOLDER_ADVANCE_RANDOM) | 1441 | if (global_settings.next_folder == FOLDER_ADVANCE_RANDOM) |
1442 | { | 1442 | { |
1443 | int fd = open(ROCKBOX_DIR "/folder_advance_list.dat", O_RDONLY); | 1443 | char folder_advance_list[MAX_PATH]; |
1444 | get_user_file_path(ROCKBOX_DIR, FORCE_BUFFER_COPY, | ||
1445 | folder_advance_list, sizeof(folder_advance_list)); | ||
1446 | strlcat(folder_advance_list, "/folder_advance_list.dat", | ||
1447 | sizeof(folder_advance_list)); | ||
1448 | int fd = open(folder_advance_list, O_RDONLY); | ||
1444 | if (fd >= 0) | 1449 | if (fd >= 0) |
1445 | { | 1450 | { |
1446 | char buffer[MAX_PATH]; | 1451 | char buffer[MAX_PATH]; |
@@ -1910,7 +1915,8 @@ void playlist_init(void) | |||
1910 | struct playlist_info* playlist = ¤t_playlist; | 1915 | struct playlist_info* playlist = ¤t_playlist; |
1911 | 1916 | ||
1912 | playlist->current = true; | 1917 | playlist->current = true; |
1913 | strlcpy(playlist->control_filename, PLAYLIST_CONTROL_FILE, | 1918 | get_user_file_path(PLAYLIST_CONTROL_FILE, IS_FILE|NEED_WRITE|FORCE_BUFFER_COPY, |
1919 | playlist->control_filename, | ||
1914 | sizeof(playlist->control_filename)); | 1920 | sizeof(playlist->control_filename)); |
1915 | playlist->fd = -1; | 1921 | playlist->fd = -1; |
1916 | playlist->control_fd = -1; | 1922 | playlist->control_fd = -1; |