aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-06-23 10:27:44 +0200
committerShauren <shauren.trinity@gmail.com>2023-06-23 10:27:44 +0200
commit8ffc4c1034931d04f9904187c76b730f2ae61965 (patch)
treed8892ca628fbb2272e3660147c01205e6ce6be94 /src/tools
parent9ad1e5d635e2fd4c2486d5f2bf1cb52d8e768558 (diff)
Tools/Extractors: Warn when casc storage could not be opened in remote mode because a local installation was detected in input/cache directory
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/extractor_common/CascHandles.cpp10
-rw-r--r--src/tools/map_extractor/System.cpp3
-rw-r--r--src/tools/vmap4_assembler/TileAssembler.cpp2
3 files changed, 13 insertions, 2 deletions
diff --git a/src/tools/extractor_common/CascHandles.cpp b/src/tools/extractor_common/CascHandles.cpp
index d06bc7ed74e..7a984fb0784 100644
--- a/src/tools/extractor_common/CascHandles.cpp
+++ b/src/tools/extractor_common/CascHandles.cpp
@@ -47,6 +47,7 @@ char const* CASC::HumanReadableCASCError(uint32 error)
case ERROR_ACCESS_DENIED: return "ACCESS_DENIED";
case ERROR_FILE_NOT_FOUND: return "FILE_NOT_FOUND";
case ERROR_FILE_ENCRYPTED: return "FILE_ENCRYPTED";
+ case ERROR_FILE_OFFLINE: return "FILE_OFFLINE";
default: return "UNKNOWN";
}
}
@@ -210,6 +211,15 @@ CASC::Storage* CASC::Storage::OpenRemote(boost::filesystem::path const& path, ui
return nullptr;
}
+ DWORD features = 0;
+ if (!GetStorageInfo(handle, CascStorageFeatures, &features) || !(features & CASC_FEATURE_ONLINE))
+ {
+ printf("Local casc storage detected in cache path \"%s\" (or its parent directory). Remote storage not opened!\n", args.szLocalPath);
+ CascCloseStorage(handle);
+ SetCascError(ERROR_FILE_OFFLINE);
+ return nullptr;
+ }
+
printf("Opened remote casc storage '%s'\n", path.string().c_str());
Storage* storage = new Storage(handle);
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index ef1c02468f7..6257e4c6ff2 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -148,7 +148,8 @@ void CreateDir(boost::filesystem::path const& path)
if (fs::exists(path))
return;
- if (!fs::create_directory(path))
+ boost::system::error_code err;
+ if (!fs::create_directory(path, err) || err)
throw std::runtime_error("Unable to create directory" + path.string());
}
diff --git a/src/tools/vmap4_assembler/TileAssembler.cpp b/src/tools/vmap4_assembler/TileAssembler.cpp
index 12b1abcafdb..62f2be7ca66 100644
--- a/src/tools/vmap4_assembler/TileAssembler.cpp
+++ b/src/tools/vmap4_assembler/TileAssembler.cpp
@@ -49,7 +49,7 @@ namespace VMAP
TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName)
: iDestDir(pDestDirName), iSrcDir(pSrcDirName)
{
- boost::filesystem::create_directory(iDestDir);
+ boost::filesystem::create_directories(iDestDir);
}
TileAssembler::~TileAssembler()