mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Tools/MapExtractor: give a nice error message on failing to CascOpenStorage()
This commit is contained in:
@@ -27,6 +27,7 @@ add_executable(mapextractor
|
||||
target_link_libraries(mapextractor
|
||||
${BZIP2_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
||||
casc
|
||||
)
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user