diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-03-10 23:19:27 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-03-10 23:19:27 +0100 |
commit | f4ff0489ca0df27ebca37b8423b8dab61f2978cc (patch) | |
tree | 23a0210715a0eb9d37a6b52f2abfdb6c20b855a8 | |
parent | 0aa3a0b0b9430d2b92e6a69e6c3bc205bfebfa57 (diff) |
Tools/mapextractor: Don't print updating progress % when sending output to file instead of console
-rw-r--r-- | src/tools/map_extractor/System.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 8e557095c45..6876b58a7cc 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -36,6 +36,11 @@ #include <unordered_map> #include <cstdlib> #include <cstring> +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS +#include <io.h> +#else +#include <unistd.h> +#endif std::shared_ptr<CASC::Storage> CascStorage; @@ -68,6 +73,7 @@ std::unordered_map<uint32, LiquidMaterialEntry> LiquidMaterials; std::unordered_map<uint32, LiquidObjectEntry> LiquidObjects; std::unordered_map<uint32, LiquidTypeEntry> LiquidTypes; std::set<uint32> CameraFileDataIds; +bool PrintProgress = true; boost::filesystem::path input_path; boost::filesystem::path output_path; @@ -1149,7 +1155,8 @@ void ExtractMaps(uint32 build) } // draw progress bar - printf("Processing........................%d%%\r", (100 * (y + 1)) / WDT_MAP_SIZE); + if (PrintProgress) + printf("Processing........................%d%%\r", (100 * (y + 1)) / WDT_MAP_SIZE); } } @@ -1483,6 +1490,7 @@ int main(int argc, char * arg[]) { Trinity::Banner::Show("Map & DBC Extractor", [](char const* text) { printf("%s\n", text); }, nullptr); + PrintProgress = isatty(fileno(stdout)); input_path = boost::filesystem::current_path(); output_path = boost::filesystem::current_path(); |