aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-01-28 14:02:01 +0100
committerShauren <shauren.trinity@gmail.com>2017-01-28 14:02:01 +0100
commit108c358ad6f51a003e140f90ea4bc99b29865a4b (patch)
tree9dff6f04298edce96b1df068e11f6d794fa1d039
parentb6dc21c09523fb7a41e776e7bd37409f989ec1d2 (diff)
Tools/mapextractor: Fixed db2/gt output filenames when running on linux
Closes #18975
-rw-r--r--src/tools/map_extractor/System.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index d8dedacdd41..4205c26c5b2 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -1151,6 +1151,14 @@ bool ExtractFile(CASC::FileHandle const& fileInArchive, std::string const& filen
return true;
}
+char const* GetCascFilenamePart(char const* cascPath)
+{
+ if (char const* lastSep = strrchr(cascPath, '\\'))
+ return lastSep + 1;
+
+ return cascPath;
+}
+
void ExtractDBFilesClient(int l)
{
printf("Extracting dbc/db2 files...\n");
@@ -1169,7 +1177,7 @@ void ExtractDBFilesClient(int l)
{
if (CASC::FileHandle dbcFile = CASC::OpenFile(CascStorage, fileName, CASC_LOCALE_NONE))
{
- boost::filesystem::path filePath = localePath / boost::filesystem::path(fileName).filename();
+ boost::filesystem::path filePath = localePath / GetCascFilenamePart(fileName);
if (!boost::filesystem::exists(filePath))
if (ExtractFile(dbcFile, filePath.string()))
@@ -1237,7 +1245,7 @@ void ExtractGameTables()
{
if (CASC::FileHandle dbcFile = CASC::OpenFile(CascStorage, fileName, CASC_LOCALE_NONE))
{
- boost::filesystem::path filePath = outputPath / boost::filesystem::path(fileName).filename();
+ boost::filesystem::path filePath = outputPath / GetCascFilenamePart(fileName);
if (!boost::filesystem::exists(filePath))
if (ExtractFile(dbcFile, filePath.string()))