From a83a38eba81a2c44347149cecf9769c8a263de7c Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Sun, 13 Nov 2022 13:07:49 +0800 Subject: [PATCH] Fixed bin and obj folders respawning and causing engine crashes --- SHADE_Engine/src/Scripting/SHScriptEngine.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp index f279bec1..18c2b9e3 100644 --- a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp +++ b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp @@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited. #include // std::fstream #include // std::filesystem::canonical, std::filesystem::remove #include // std::shared_ptr +#include // std::this_thread::sleep_for // Project Headers #include "Tools/SHLogger.h" #include "Tools/SHStringUtils.h" @@ -25,7 +26,6 @@ of DigiPen Institute of Technology is prohibited. #include "Events/SHEventReceiver.h" #include "Events/SHEventManager.hpp" #include "Physics/SHPhysicsSystem.h" - #include "Assets/SHAssetMacros.h" namespace SHADE @@ -177,10 +177,10 @@ namespace SHADE } // Prepare directory (delete useless files) - deleteFolder(CSPROJ_DIR + "\\net5.0"); - deleteFolder(CSPROJ_DIR + "\\ref"); - deleteFolder(CSPROJ_DIR + "\\obj"); - deleteFolder(CSPROJ_DIR + "\\bin"); + deleteFolder(CSPROJ_DIR + "/net5.0"); + deleteFolder(CSPROJ_DIR + "/ref"); + deleteFolder(CSPROJ_DIR + "/obj"); + deleteFolder(CSPROJ_DIR + "/bin"); // Attempt to build the assembly std::ostringstream oss; @@ -214,7 +214,10 @@ namespace SHADE // Clean up built files deleteFolder("./tmp"); - deleteFolder(CSPROJ_DIR + "\\obj"); + deleteFolder(CSPROJ_DIR + "/bin"); + using namespace std::chrono_literals; + std::this_thread::sleep_for(50ms); // Not sure why this works but it prevents the folders from respawning + deleteFolder(CSPROJ_DIR + "/obj"); // Read the build log and output to the console dumpBuildLog(BUILD_LOG_PATH);