summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2005-01-18 22:50:47 +0000
committerBjörn Stenberg <bjorn@haxx.se>2005-01-18 22:50:47 +0000
commitcdd79a35d40b314a723752cd40eb03ece79620b9 (patch)
treeff31772a603d41fc1f70ce84ea895493d1e82d14 /apps
parent84c7d8802106266c94d0a30827dff418a2fcac6d (diff)
downloadrockbox-cdd79a35d40b314a723752cd40eb03ece79620b9.tar.gz
rockbox-cdd79a35d40b314a723752cd40eb03ece79620b9.tar.bz2
rockbox-cdd79a35d40b314a723752cd40eb03ece79620b9.zip
Repaired broken resume
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5596 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/filetree.c9
-rw-r--r--apps/filetree.h2
-rw-r--r--apps/playlist.c6
-rw-r--r--apps/tree.c6
4 files changed, 13 insertions, 10 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index a46ffbb2bc..324266e64f 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -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 */
diff --git a/apps/filetree.h b/apps/filetree.h
index 143b75ad66..cdcdfca261 100644
--- a/apps/filetree.h
+++ b/apps/filetree.h
@@ -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);
diff --git a/apps/playlist.c b/apps/playlist.c
index 4506ec5f54..651a5afeea 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -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)
{
diff --git a/apps/tree.c b/apps/tree.c
index 2ba4585047..e4c6110040 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -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;
}