summaryrefslogtreecommitdiff
path: root/src/fileio.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-09-08 09:48:52 +0000
committerrubidium <rubidium@openttd.org>2011-09-08 09:48:52 +0000
commit414c397000935162df4641dbe0c056b39d32205e (patch)
tree017dc3d94c6c765e1ba9fa28e46f536b7ec1b384 /src/fileio.cpp
parent92244f1663367a14051578daa4120c748b1ba9f4 (diff)
downloadopenttd-414c397000935162df4641dbe0c056b39d32205e.tar.xz
(svn r22904) -Codechange: add tar filename to file scanning
Diffstat (limited to 'src/fileio.cpp')
-rw-r--r--src/fileio.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 86714d108..dbf0bc01b 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -647,8 +647,11 @@ static void SimplifyFileName(char *name)
return num;
}
-bool TarScanner::AddFile(const char *filename, size_t basepath_length)
+bool TarScanner::AddFile(const char *filename, size_t basepath_length, const char *tar_filename)
{
+ /* No tar within tar. */
+ assert(tar_filename == NULL);
+
/* The TAR-header, repeated for every file */
typedef struct TarHeader {
char name[100]; ///< Name of the file
@@ -1281,7 +1284,7 @@ static uint ScanPath(FileScanner *fs, const char *extension, const char *path, s
num += ScanPath(fs, extension, filename, basepath_length, recursive);
} else if (S_ISREG(sb.st_mode)) {
/* File */
- if (MatchesExtension(extension, filename) && fs->AddFile(filename, basepath_length)) num++;
+ if (MatchesExtension(extension, filename) && fs->AddFile(filename, basepath_length, NULL)) num++;
}
}
@@ -1301,7 +1304,7 @@ static uint ScanTar(FileScanner *fs, const char *extension, TarFileList::iterato
uint num = 0;
const char *filename = (*tar).first.c_str();
- if (MatchesExtension(extension, filename) && fs->AddFile(filename, 0)) num++;
+ if (MatchesExtension(extension, filename) && fs->AddFile(filename, 0, (*tar).second.tar_filename)) num++;
return num;
}