aboutsummaryrefslogtreecommitdiff
path: root/src/tools/vmap4_extractor
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-08-18 16:45:36 +0200
committerShauren <shauren.trinity@gmail.com>2017-08-18 16:45:36 +0200
commit7eab6dbb9542118c14899452c7d0cb550e6263a6 (patch)
tree96fd38d6451e0bed7395f79e29fd2aa02458df5b /src/tools/vmap4_extractor
parent3f3991362848d80721dc8f4607518a9e451b60ad (diff)
Tools/Extractors: Implement proper installed locale detection
Diffstat (limited to 'src/tools/vmap4_extractor')
-rw-r--r--src/tools/vmap4_extractor/vmapexport.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp
index 35c6eb1f452..88765704954 100644
--- a/src/tools/vmap4_extractor/vmapexport.cpp
+++ b/src/tools/vmap4_extractor/vmapexport.cpp
@@ -162,6 +162,25 @@ bool OpenCascStorage(int locale)
}
}
+uint32 GetInstalledLocalesMask()
+{
+ try
+ {
+ boost::filesystem::path const storage_dir(boost::filesystem::canonical(input_path) / "Data");
+ CASC::StorageHandle storage = CASC::OpenStorage(storage_dir, 0);
+ if (!storage)
+ return false;
+
+ return CASC::GetInstalledLocalesMask(storage);
+ }
+ catch (boost::filesystem::filesystem_error const& error)
+ {
+ printf("Unable to determine installed locales mask: %s\n", error.what());
+ }
+
+ return 0;
+}
+
// Local testing functions
bool FileExists(const char* file)
{
@@ -414,12 +433,16 @@ int main(int argc, char ** argv)
))
success = (errno == EEXIST);
- int FirstLocale = -1;
+ uint32 installedLocalesMask = GetInstalledLocalesMask();
+ int32 FirstLocale = -1;
for (int i = 0; i < TOTAL_LOCALES; ++i)
{
if (i == LOCALE_none)
continue;
+ if (!(installedLocalesMask & WowLocaleToCascLocaleFlags[i]))
+ continue;
+
if (!OpenCascStorage(i))
continue;