Bugfix: recursive directory properties could not be aborted
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11751 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
20338ca60d
commit
1936f7c460
1 changed files with 7 additions and 9 deletions
|
@ -134,7 +134,7 @@ static bool _dir_properties(DPS* dps)
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result = 0;
|
result = true;
|
||||||
dirlen = rb->strlen(dps->dirname);
|
dirlen = rb->strlen(dps->dirname);
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
dir = rb->opendir_cached(dps->dirname);
|
dir = rb->opendir_cached(dps->dirname);
|
||||||
|
@ -146,9 +146,9 @@ static bool _dir_properties(DPS* dps)
|
||||||
|
|
||||||
/* walk through the directory content */
|
/* walk through the directory content */
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
while((!result) && (0 != (entry = rb->readdir_cached(dir))))
|
while(result && (0 != (entry = rb->readdir_cached(dir))))
|
||||||
#else
|
#else
|
||||||
while((!result) && (0 != (entry = rb->readdir(dir))))
|
while(result && (0 != (entry = rb->readdir(dir))))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* append name to current directory */
|
/* append name to current directory */
|
||||||
|
@ -178,14 +178,14 @@ static bool _dir_properties(DPS* dps)
|
||||||
#endif
|
#endif
|
||||||
/* recursion */
|
/* recursion */
|
||||||
result = _dir_properties(dps);
|
result = _dir_properties(dps);
|
||||||
if(rb->get_action(CONTEXT_TREE,TIMEOUT_NOBLOCK))
|
|
||||||
result = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dps->fc++; /* new file */
|
dps->fc++; /* new file */
|
||||||
dps->bc += entry->size;
|
dps->bc += entry->size;
|
||||||
}
|
}
|
||||||
|
if(ACTION_STD_CANCEL == rb->get_action(CONTEXT_STD,TIMEOUT_NOBLOCK))
|
||||||
|
result = false;
|
||||||
rb->yield();
|
rb->yield();
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
|
@ -194,8 +194,6 @@ static bool _dir_properties(DPS* dps)
|
||||||
rb->closedir(dir);
|
rb->closedir(dir);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(rb->action_userabort(0)) result = false;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,8 +206,8 @@ static bool dir_properties(char* selected_file)
|
||||||
dps.dc = 0;
|
dps.dc = 0;
|
||||||
dps.fc = 0;
|
dps.fc = 0;
|
||||||
dps.bc = 0;
|
dps.bc = 0;
|
||||||
if(_dir_properties(&dps))
|
if(false == _dir_properties(&dps))
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
rb->snprintf(str_dirname, MAX_PATH, selected_file);
|
rb->snprintf(str_dirname, MAX_PATH, selected_file);
|
||||||
rb->snprintf(str_dircount, sizeof str_dircount, "Subdirs: %d", dps.dc);
|
rb->snprintf(str_dircount, sizeof str_dircount, "Subdirs: %d", dps.dc);
|
||||||
|
|
Loading…
Reference in a new issue