diff options
author | yexo <yexo@openttd.org> | 2009-03-14 23:57:37 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-03-14 23:57:37 +0000 |
commit | 86a9df82b733db7c95ef1ffc659ec7d5f11fe755 (patch) | |
tree | 86fcb9623d3f9544ba6e7e54a0235595090a48a5 | |
parent | bbb28d210a37ecf53170030624eb91c899972b39 (diff) | |
download | openttd-86a9df82b733db7c95ef1ffc659ec7d5f11fe755.tar.xz |
(svn r15716) -Change [NoAI]: AI libraries should now be stored in ai/library/<library_name>/ instead of ai/library/<category_name>/<library_name>/. Libraries inside tar files are not affected.
-rw-r--r-- | src/ai/ai_scanner.cpp | 15 | ||||
-rw-r--r-- | src/ai/ai_scanner.hpp | 2 |
2 files changed, 4 insertions, 13 deletions
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; |