summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2008-02-04 21:20:04 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2008-02-04 21:20:04 +0000
commit2d12b253ae14769fdb808c972ca8e92f4416b3bb (patch)
tree6dd8e8a919e14d03d294df319353cc9b03554bc7
parentbed73ee759569f44e9595440746b51ad3ccdcc3f (diff)
downloadrockbox-2d12b253ae14769fdb808c972ca8e92f4416b3bb.tar.gz
rockbox-2d12b253ae14769fdb808c972ca8e92f4416b3bb.zip
add support for database.unignore files (adds dirs to the database which would be skipped because of a database.ignore file)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16214 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagcache.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 6c38300a16..a53bdc7f84 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -4062,11 +4062,12 @@ static bool check_deleted_files(void)
4062 return true; 4062 return true;
4063} 4063}
4064 4064
4065static bool check_dir(const char *dirname) 4065static bool check_dir(const char *dirname, int add_files)
4066{ 4066{
4067 DIR *dir; 4067 DIR *dir;
4068 int len; 4068 int len;
4069 int success = false; 4069 int success = false;
4070 int ignore, unignore;
4070 char newpath[MAX_PATH]; 4071 char newpath[MAX_PATH];
4071 4072
4072 dir = opendir(dirname); 4073 dir = opendir(dirname);
@@ -4078,12 +4079,15 @@ static bool check_dir(const char *dirname)
4078 4079
4079 /* check for a database.ignore file */ 4080 /* check for a database.ignore file */
4080 snprintf(newpath, MAX_PATH, "%s/database.ignore", dirname); 4081 snprintf(newpath, MAX_PATH, "%s/database.ignore", dirname);
4081 if (file_exists(newpath)) 4082 ignore = file_exists(newpath);
4082 { 4083 /* check for a database.unignore file */
4083 closedir(dir); 4084 snprintf(newpath, MAX_PATH, "%s/database.unignore", dirname);
4084 return false; 4085 unignore = file_exists(newpath);
4085 } 4086
4086 4087 /* don't do anything if both ignore and unignore are there */
4088 if (ignore != unignore)
4089 add_files = unignore;
4090
4087 /* Recursively scan the dir. */ 4091 /* Recursively scan the dir. */
4088#ifdef __PCTOOL__ 4092#ifdef __PCTOOL__
4089 while (1) 4093 while (1)
@@ -4113,8 +4117,8 @@ static bool check_dir(const char *dirname)
4113 4117
4114 processed_dir_count++; 4118 processed_dir_count++;
4115 if (entry->attribute & ATTR_DIRECTORY) 4119 if (entry->attribute & ATTR_DIRECTORY)
4116 check_dir(curpath); 4120 check_dir(curpath, add_files);
4117 else 4121 else if (add_files)
4118 { 4122 {
4119 tc_stat.curentry = curpath; 4123 tc_stat.curentry = curpath;
4120 4124
@@ -4193,7 +4197,7 @@ void build_tagcache(const char *path)
4193 4197
4194 if (strcmp("/", path) != 0) 4198 if (strcmp("/", path) != 0)
4195 strcpy(curpath, path); 4199 strcpy(curpath, path);
4196 ret = check_dir(path); 4200 ret = check_dir(path, true);
4197 4201
4198 /* Write the header. */ 4202 /* Write the header. */
4199 header.magic = TAGCACHE_MAGIC; 4203 header.magic = TAGCACHE_MAGIC;