Tools/MapExtractor: give a nice error message on failing to CascOpenStorage()

This commit is contained in:
Bernd Lörwald
2014-10-29 23:38:01 +01:00
parent 13281fef3c
commit 7a3d5bb50f
2 changed files with 8 additions and 6 deletions

View File

@@ -27,6 +27,7 @@ add_executable(mapextractor
target_link_libraries(mapextractor
${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES}
${Boost_LIBRARIES}
casc
)

View File

@@ -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;
}