Fixed crash on launch due to script rebuilds and support undo-ing add/remove of scripts #195

Merged
Pycorax merged 5 commits from SP3-6-c-scripting into main 2022-11-13 14:52:33 +08:00
1 changed files with 9 additions and 6 deletions
Showing only changes of commit a83a38eba8 - Show all commits

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);