diff options
author | Bernd Lörwald <bloerwald@googlemail.com> | 2014-10-29 23:38:01 +0100 |
---|---|---|
committer | Bernd Lörwald <bloerwald@googlemail.com> | 2014-10-29 23:40:34 +0100 |
commit | 7a3d5bb50ff9db72dc39b905476e983681f7ca86 (patch) | |
tree | 692c5e29521f738cd632c8b1976f1f2d22caae62 /src | |
parent | 13281fef3c85688df18b5ea7cfab74411c6529f7 (diff) |
Tools/MapExtractor: give a nice error message on failing to CascOpenStorage()
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/map_extractor/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/tools/map_extractor/System.cpp | 13 |
2 files changed, 8 insertions, 6 deletions
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 <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> + #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; } |