diff --git a/MapBuilder/FileExist.cpp b/MapBuilder/FileExist.cpp index f83c4fb..28b3ce3 100644 --- a/MapBuilder/FileExist.cpp +++ b/MapBuilder/FileExist.cpp @@ -14,8 +14,7 @@ bool map_files_exist(const std::string& outputPath, const std::string& mapName) return fs::exists(outputPath + "/" + mapName + ".map"); } -bool wow_exist_at_root(const std::string& rootPath) -{ +bool wow_exist_at_root(const std::string& rootPath) { return fs::exists(rootPath + "/" + "WoW.exe"); } @@ -23,16 +22,16 @@ bool wow_exist_at_root(const std::string& rootPath) namespace dir_exist { -bool output_dir_exist() { - return fs::exists("./Output"); +bool output_dir_exist(const std::string& outputPath) { + return fs::exists(outputPath); } } // namespace dir_exist namespace files { -void create_output_directory() { - fs::create_directory("./Output"); +void create_output_directory(const std::string& outputPath) { + fs::create_directory(outputPath); } void create_bvh_output_directory(const std::filesystem::path& outputPath) { diff --git a/MapBuilder/FileExist.hpp b/MapBuilder/FileExist.hpp index ab81d10..591b03d 100644 --- a/MapBuilder/FileExist.hpp +++ b/MapBuilder/FileExist.hpp @@ -13,13 +13,13 @@ bool wow_exist_at_root(const std::string& rootPath); namespace dir_exist { -bool output_dir_exist(); +bool output_dir_exist(const std::string& rootPath); } // namespace dir_exist namespace files { -void create_output_directory(); +void create_output_directory(const std::string& rootPath); void create_bvh_output_directory(const std::filesystem::path& outputPath); diff --git a/MapBuilder/main.cpp b/MapBuilder/main.cpp index 8d5e29d..4354bd8 100644 --- a/MapBuilder/main.cpp +++ b/MapBuilder/main.cpp @@ -210,7 +210,7 @@ int ExtractMap(const std::string& map, const std::string& dataPath, int main(int argc, char* argv[]) { std::string dataPath, map, outputPath, goCSVPath; - int adtX = -1, adtY = -1, threads = 1, logLevel; + int adtX = -1, adtY = -1, threads = 1, logLevel = 1; bool bvh = false; bool alpha = true; @@ -282,14 +282,17 @@ int main(int argc, char* argv[]) outputPath = "./Output"; const std::filesystem::path root(dataPath); - if (!file_exist::wow_exist_at_root(root.parent_path().string())) + const std::string rootStr = root.parent_path().string(); + if (!file_exist::wow_exist_at_root(rootStr)) { std::cerr << "ERROR: MapBuilder must be placed inside the game root folder" << std::endl; return EXIT_FAILURE; } - if (!dir_exist::output_dir_exist()) - files::create_output_directory(); + const std::filesystem::path rootOutputPath(outputPath); + const std::string rootOutputPathStr = rootOutputPath.string(); + if (!dir_exist::output_dir_exist(rootOutputPathStr)) + files::create_output_directory(rootOutputPathStr); if (ExtractBVH(goCSVPath, dataPath, outputPath, threads) == EXIT_FAILURE) return EXIT_FAILURE;