From 66b45eeb596af1bd950832cd16b3752430f691c4 Mon Sep 17 00:00:00 2001 From: Henrik Backe Date: Fri, 10 Sep 2004 20:51:12 +0000 Subject: Added check for missing .rockbox directory to playlist code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5063 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 13 ++++++++++--- apps/tree.c | 19 +++++++++++++------ apps/tree.h | 1 + 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index 8d4f62db68..5725c4be85 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -247,10 +247,17 @@ static void create_control(struct playlist_info* playlist) playlist->control_fd = creat(playlist->control_filename, 0000200); if (playlist->control_fd < 0) { - splash(HZ*2, true, "%s (%d)", str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), - playlist->control_fd); + if (check_rockboxdir()) + { + splash(HZ*2, true, "%s (%d)", str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), + playlist->control_fd); + } + playlist->control_created = false; + } + else + { + playlist->control_created = true; } - playlist->control_created = true; } /* diff --git a/apps/tree.c b/apps/tree.c index 7be258c4db..90d7010d03 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -120,20 +120,27 @@ static bool boot_changed = false; static bool start_wps = false; static bool dirbrowse(const char *root, const int *dirfilter); -void browse_root(void) +bool check_rockboxdir(void) { - filetype_init(); - -#ifndef SIMULATOR DIR *dir = opendir(ROCKBOX_DIR); if(!dir) { lcd_clear_display(); - splash(HZ*5, true, str(LANG_NO_ROCKBOX_DIR)); + splash(HZ*2, true, str(LANG_NO_ROCKBOX_DIR)); lcd_clear_display(); - splash(HZ*5, true, str(LANG_INSTALLATION_INCOMPLETE)); + splash(HZ*2, true, str(LANG_INSTALLATION_INCOMPLETE)); + return false; } closedir(dir); + return true; +} + +void browse_root(void) +{ + filetype_init(); + check_rockboxdir(); + +#ifndef SIMULATOR dirbrowse("/", &global_settings.dirfilter); #else diff --git a/apps/tree.h b/apps/tree.h index 5a618a8bc3..dd08ca9392 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -59,5 +59,6 @@ char *getcwd(char *buf, int size); void reload_directory(void); struct entry* load_and_sort_directory(const char *dirname, const int *dirfilter, int *num_files, bool *buffer_full); +bool check_rockboxdir(void); #endif -- cgit v1.2.3