summaryrefslogtreecommitdiff
path: root/apps/tagcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r--apps/tagcache.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 40f9c28c33..c8900f5c38 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -4990,10 +4990,56 @@ void do_tagcache_build(const char *path[])
4990 4990
4991 roots_ll[0].path = path[0]; 4991 roots_ll[0].path = path[0];
4992 roots_ll[0].next = NULL; 4992 roots_ll[0].next = NULL;
4993
4994#if defined HAVE_MULTIVOLUME && !defined(SIMULATOR) && !defined(__PCTOOL__)
4995 extern bool ns_volume_is_visible(int volume); /*rb_namespace.c*/
4996 /* i is for the path vector, j for the roots_ll array */
4997 int i = 1, j = 1;
4998 bool added = false;
4999 char volnamebuf[NUM_VOLUMES][VOL_MAX_LEN + 1];
5000 /* we can just parse the root directory ('/') and get to any mounted
5001 * volume but we can also enumerate a volume in the root directory
5002 * when this occurs it leads to multiple entries since the files can
5003 * be reached through multiple paths ex, /Foo could also be /SD1/Foo
5004 * we used to hide the volume that was mapped but then when you switch
5005 * from the sd to the internal the paths don't map to the right volume
5006 * instead we will attempt to rewrite the root with any non-hidden volumes
5007 * failing that just leave the paths alone */
5008 if (!strcmp(PATH_ROOTSTR, path[0]))
5009 {
5010 i = 0;
5011 j = 0;
5012 }
5013 /* path can be skipped , but root_ll entries can't */
5014 for(; path[i] && j < MAX_STATIC_ROOTS; i++)
5015 {
5016 /* check if the link target is inside of an existing search root
5017 * don't add if target is inside, we'll scan it later */
5018 if (!added && !strcmp(PATH_ROOTSTR, path[i]))
5019 {
5020 for (int v = 0; v < NUM_VOLUMES; v++)
5021 {
5022 if (ns_volume_is_visible(v))
5023 {
5024 make_volume_root(v, volnamebuf[v]);
5025 roots_ll[j].path = volnamebuf[v];
5026 if (j > 0)
5027 roots_ll[j-1].next = &roots_ll[j];
5028 j++;
5029 added = true;
5030 }
5031 }
5032 if(!added)
5033 j = 1;
5034 added = true;
5035 continue;
5036 }
5037#else
4993 /* i is for the path vector, j for the roots_ll array 5038 /* i is for the path vector, j for the roots_ll array
4994 * path can be skipped , but root_ll entries can't */ 5039 * path can be skipped , but root_ll entries can't */
4995 for(int i = 1, j = 1; path[i] && j < MAX_STATIC_ROOTS; i++) 5040 for(int i = 1, j = 1; path[i] && j < MAX_STATIC_ROOTS; i++)
4996 { 5041 {
5042#endif /*def HAVE_MULTIVOLUME*/
4997 if (search_root_exists(path[i])) /* skip this path */ 5043 if (search_root_exists(path[i])) /* skip this path */
4998 continue; 5044 continue;
4999 5045
@@ -5006,6 +5052,7 @@ void do_tagcache_build(const char *path[])
5006 /* check_dir might add new roots */ 5052 /* check_dir might add new roots */
5007 for(this = &roots_ll[0]; this; this = this->next) 5053 for(this = &roots_ll[0]; this; this = this->next)
5008 { 5054 {
5055 logf("Search root %s", this->path);
5009 strmemccpy(curpath, this->path, sizeof(curpath)); 5056 strmemccpy(curpath, this->path, sizeof(curpath));
5010 ret = ret && check_dir(this->path, true); 5057 ret = ret && check_dir(this->path, true);
5011 } 5058 }