From 6fe181ae64f2167b87e03a743f039e63ccfa2a22 Mon Sep 17 00:00:00 2001 From: yexo Date: Sat, 14 Mar 2009 23:57:37 +0000 Subject: (svn r15716) -Change [NoAI]: AI libraries should now be stored in ai/library// instead of ai/library///. Libraries inside tar files are not affected. --- src/ai/ai_scanner.cpp | 15 +++------------ src/ai/ai_scanner.hpp | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp index d36976401..afeaea404 100644 --- a/src/ai/ai_scanner.cpp +++ b/src/ai/ai_scanner.cpp @@ -20,7 +20,7 @@ #include "ai_scanner.hpp" #include "api/ai_controller.hpp" -void AIScanner::ScanDir(const char *dirname, bool library_scan, bool library_recursive) +void AIScanner::ScanDir(const char *dirname, bool library_scan) { extern bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb); extern bool FiosIsHiddenFile(const struct dirent *ent); @@ -48,19 +48,10 @@ void AIScanner::ScanDir(const char *dirname, bool library_scan, bool library_rec ttd_strlcpy(temp_script, dirname, sizeof(temp_script)); ttd_strlcat(temp_script, d_name, sizeof(temp_script)); - if (S_ISDIR(sb.st_mode)) { - /* Libraries are always in a subdirectory of their category, so scan those */ - if (library_scan && !library_recursive) { - ttd_strlcat(temp_script, PATHSEP, sizeof(temp_script)); - ScanDir(temp_script, library_scan, true); - continue; - } - } else if (S_ISREG(sb.st_mode)) { + if (S_ISREG(sb.st_mode)) { /* Only .tar files are allowed */ char *ext = strrchr(d_name, '.'); if (ext == NULL || strcasecmp(ext, ".tar") != 0) continue; - /* .tar files are only allowed in the root of the library dir */ - if (library_recursive) continue; /* We always expect a directory in the TAR */ const char *first_dir = FioTarFirstDir(temp_script); @@ -69,7 +60,7 @@ void AIScanner::ScanDir(const char *dirname, bool library_scan, bool library_rec ttd_strlcat(temp_script, PATHSEP, sizeof(temp_script)); ttd_strlcat(temp_script, first_dir, sizeof(temp_script)); FioTarAddLink(temp_script, first_dir); - } else { + } else if (!S_ISDIR(sb.st_mode)) { /* Skip any other type of file */ continue; } diff --git a/src/ai/ai_scanner.hpp b/src/ai/ai_scanner.hpp index b79cf4984..dbbadb1e8 100644 --- a/src/ai/ai_scanner.hpp +++ b/src/ai/ai_scanner.hpp @@ -88,7 +88,7 @@ private: * For library-scan, if a library is found, AILibrary is created, and the * library is registered to the central system. */ - void ScanDir(const char *dirname, bool library_dir, bool library_recursive = false); + void ScanDir(const char *dirname, bool library_dir); AIInfo *info_dummy; AIInfoList info_list; -- cgit v1.2.3-54-g00ecf