mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(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.
This commit is contained in:
parent
bbb28d210a
commit
86a9df82b7
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user