diff -r fa96e29d7187 -r 982e9f814f97 src/fileio.cpp --- a/src/fileio.cpp Tue Jul 22 18:29:06 2008 +0300 +++ b/src/fileio.cpp Tue Jul 22 21:51:14 2008 +0300 @@ -483,7 +483,7 @@ #endif } -static bool TarListAddFile(const char *filename) +static bool TarListAddFile(const char *filename, Subdirectory subdir) { /* The TAR-header, repeated for every file */ typedef struct TarHeader { @@ -516,6 +516,7 @@ TarListEntry *tar_entry = MallocT(1); tar_entry->filename = strdup(filename); + tar_entry->subdir = subdir; _tar_list.insert(TarList::value_type(filename, tar_entry)); TarLinkList links; ///< Temporary list to collect links @@ -694,7 +695,7 @@ return true; } -static int ScanPathForTarFiles(const char *path, size_t basepath_length) +static int ScanPathForTarFiles(const char *path, size_t basepath_length, Subdirectory subdir) { extern bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb); @@ -717,7 +718,7 @@ /* Directory */ if (strcmp(d_name, ".") == 0 || strcmp(d_name, "..") == 0) continue; AppendPathSeparator(filename, lengthof(filename)); - num += ScanPathForTarFiles(filename, basepath_length); + num += ScanPathForTarFiles(filename, basepath_length, subdir); } else if (sb.st_mode & S_IFREG) { /* File */ char *ext = strrchr(filename, '.'); @@ -726,7 +727,7 @@ if (ext == NULL) continue; if (strcasecmp(ext, ".tar") != 0) continue; - if (TarListAddFile(filename)) num++; + if (TarListAddFile(filename, subdir)) num++; } } @@ -743,7 +744,10 @@ DEBUG(misc, 1, "Scanning for tars"); FOR_ALL_SEARCHPATHS(sp) { FioAppendDirectory(path, MAX_PATH, sp, DATA_DIR); - num += ScanPathForTarFiles(path, strlen(path)); + num += ScanPathForTarFiles(path, strlen(path), DATA_DIR); + + FioAppendDirectory(path, MAX_PATH, sp, CACHE_DIR); + num += ScanPathForTarFiles(path, strlen(path), CACHE_DIR); } DEBUG(misc, 1, "Scan complete, found %d files", num); }