From 7a3d5bb50ff9db72dc39b905476e983681f7ca86 Mon Sep 17 00:00:00 2001 From: Bernd Lörwald Date: Wed, 29 Oct 2014 23:38:01 +0100 Subject: Tools/MapExtractor: give a nice error message on failing to CascOpenStorage() --- src/tools/map_extractor/CMakeLists.txt | 1 + src/tools/map_extractor/System.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/tools/map_extractor/CMakeLists.txt b/src/tools/map_extractor/CMakeLists.txt index 3d6849eee08..2fe5450ee27 100644 --- a/src/tools/map_extractor/CMakeLists.txt +++ b/src/tools/map_extractor/CMakeLists.txt @@ -27,6 +27,7 @@ add_executable(mapextractor target_link_libraries(mapextractor ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} + ${Boost_LIBRARIES} casc ) diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 2d5c21d1519..e260f393386 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -33,6 +33,9 @@ #define ERROR_PATH_NOT_FOUND ERROR_FILE_NOT_FOUND #endif +#include +#include + #include "DBFilesClientList.h" #include "CascLib.h" #include "dbcfile.h" @@ -1134,13 +1137,13 @@ void ExtractDBFilesClient(int l) bool OpenCascStorage() { - if (!CascOpenStorage(".\\Data", 0, &CascStorage)) + boost::filesystem::path const storage_dir (boost::filesystem::canonical (input_path) / "Data"); + if (!CascOpenStorage(storage_dir.string().c_str(), 0, &CascStorage)) { - printf("Error %d\n", GetLastError()); + printf("error opening casc storage '%s': %d\n", storage_dir.string().c_str(), GetLastError()); return false; } - - printf("\n"); + printf("opened casc storage '%s'\n", storage_dir.string().c_str()); return true; } @@ -1156,8 +1159,6 @@ int main(int argc, char * arg[]) if (!OpenCascStorage()) { - if (GetLastError() != ERROR_PATH_NOT_FOUND) - printf("Unable to open storage!\n"); return 1; } -- cgit v1.2.3