Repaired broken resume

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5596 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2005-01-18 22:50:47 +00:00
parent 84c7d88021
commit cdd79a35d4
4 changed files with 13 additions and 10 deletions

View file

@ -184,11 +184,16 @@ static int compare(const void* p1, const void* p2)
}
/* load and sort directory into dircache. returns NULL on failure. */
int ft_load(struct tree_context* c)
int ft_load(struct tree_context* c, const char* tempdir)
{
int i;
int name_buffer_used = 0;
DIR *dir = opendir(c->currdir);
DIR *dir;
if (tempdir)
dir = opendir(tempdir);
else
dir = opendir(c->currdir);
if(!dir)
return -1; /* not a directory */

View file

@ -20,7 +20,7 @@
#define FILETREE_H
#include "tree.h"
int ft_load(struct tree_context* c);
int ft_load(struct tree_context* c, const char* tempdir);
int ft_play_filenumber(int pos, int attr);
int ft_play_dirname(int start_index);
void ft_play_filename(char *dir, char *file);

View file

@ -544,8 +544,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
/* use the tree browser dircache to load files */
global_settings.dirfilter = SHOW_ALL;
strncpy(tc->currdir, dirname, sizeof(tc->currdir));
num_files = ft_load(tc);
num_files = ft_load(tc, dirname);
files = (struct entry*) tc->dircache;
if(!num_files)
@ -584,8 +583,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
break;
/* we now need to reload our current directory */
strncpy(tc->currdir, dirname, sizeof(tc->currdir));
num_files = ft_load(tc);
num_files = ft_load(tc, dirname);
files = (struct entry*) tc->dircache;
if (!num_files)
{

View file

@ -279,7 +279,7 @@ static int showdir(void)
}
else {
if (strncmp(tc.currdir, lastdir, sizeof(lastdir)) || reload_dir) {
if (ft_load(&tc) < 0)
if (ft_load(&tc, NULL) < 0)
return -1;
strcpy(lastdir, tc.currdir);
newdir = true;
@ -499,7 +499,7 @@ static bool ask_resume(bool ask_once)
void resume_directory(const char *dir)
{
strcpy(tc.currdir, dir);
if (!ft_load(&tc))
if (ft_load(&tc, NULL) < 0)
return;
lastdir[0] = 0;
@ -602,7 +602,7 @@ static bool check_changed_id3mode(bool currmode)
db_load(&tc);
}
else
ft_load(&tc);
ft_load(&tc, NULL);
}
return currmode;
}