Fixed bugs related to C# script serialization and deserialization #277
|
@ -197,12 +197,18 @@ namespace SHADE
|
||||||
if (BUILD_SUCCESS)
|
if (BUILD_SUCCESS)
|
||||||
{
|
{
|
||||||
// Copy to built dll to the working directory and replace
|
// Copy to built dll to the working directory and replace
|
||||||
std::filesystem::copy_file("./tmp/SHADE_Scripting.dll", "SHADE_Scripting.dll", std::filesystem::copy_options::overwrite_existing);
|
if (!copyFile("./tmp/SHADE_Scripting.dll", "SHADE_Scripting.dll", std::filesystem::copy_options::overwrite_existing))
|
||||||
|
{
|
||||||
|
SHLOG_ERROR("[ScriptEngine] Failed to replace scripts assembly. Scripts will remain outdated.");
|
||||||
|
}
|
||||||
|
|
||||||
// If debug, we want to copy the PDB so that we can do script debugging
|
// If debug, we want to copy the PDB so that we can do script debugging
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
std::filesystem::copy_file("./tmp/SHADE_Scripting.pdb", "SHADE_Scripting.pdb", std::filesystem::copy_options::overwrite_existing);
|
if (!copyFile("./tmp/SHADE_Scripting.pdb", "SHADE_Scripting.pdb", std::filesystem::copy_options::overwrite_existing))
|
||||||
|
{
|
||||||
|
SHLOG_WARNING("[ScriptEngine] Breakpoint debugging will not work as PDB cannot be updated. If you are currently debugging, stop the debugger first.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oss << "[ScriptEngine] Successfully built Managed Script Assembly (" << MANAGED_SCRIPT_LIB_NAME << ")!";
|
oss << "[ScriptEngine] Successfully built Managed Script Assembly (" << MANAGED_SCRIPT_LIB_NAME << ")!";
|
||||||
|
@ -591,6 +597,19 @@ namespace SHADE
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SHScriptEngine::copyFile(const std::filesystem::path& from, const std::filesystem::path& to, const std::filesystem::copy_options options) noexcept
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return std::filesystem::copy_file(from, to, options);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
SHLOG_ERROR("[ScriptEngine] Failed to copy file {} ({})", to.string(), std::string(e.what()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DWORD SHScriptEngine::execProcess(const std::wstring& path, const std::wstring& args)
|
DWORD SHScriptEngine::execProcess(const std::wstring& path, const std::wstring& args)
|
||||||
{
|
{
|
||||||
STARTUPINFOW startInfo;
|
STARTUPINFOW startInfo;
|
||||||
|
|
|
@ -319,6 +319,7 @@ namespace SHADE
|
||||||
/// <param name="filePath">File path to the file to check.</param>
|
/// <param name="filePath">File path to the file to check.</param>
|
||||||
/// <returns> True if the file exists </returns>
|
/// <returns> True if the file exists </returns>
|
||||||
static bool fileExists(const std::filesystem::path& filePath);
|
static bool fileExists(const std::filesystem::path& filePath);
|
||||||
|
static bool copyFile(const std::filesystem::path& from, const std::filesystem::path& to, const std::filesystem::copy_options options) noexcept;
|
||||||
static DWORD execProcess(const std::wstring& path, const std::wstring& args);
|
static DWORD execProcess(const std::wstring& path, const std::wstring& args);
|
||||||
static std::wstring generateBuildCommand(bool debug);
|
static std::wstring generateBuildCommand(bool debug);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue