Fixed bin and obj folders respawning and causing engine crashes

This commit is contained in:
Kah Wei 2022-11-13 13:07:49 +08:00
parent 4b6ede88e2
commit a83a38eba8
1 changed files with 9 additions and 6 deletions

View File

@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
#include <fstream> // std::fstream
#include <filesystem> // std::filesystem::canonical, std::filesystem::remove
#include <memory> // std::shared_ptr
#include <thread> // 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);