mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
scripts: write a temp file when building modules so watchdog waits
This commit is contained in:
parent
e5fd01baaf
commit
6f457a4e7e
2 changed files with 8 additions and 0 deletions
|
@ -64,11 +64,15 @@ foreach(_scriptDir ${children})
|
|||
COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.exp"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.lib"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove "${SCRIPT_LIB_DIR}/script_${_name}.ilk"
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${SCRIPT_POSTBUILD_DIR}/${ScriptTargetName}.dll_LOCK
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SCRIPT_LIB_DIR}/script_${_name}.dll" ${SCRIPT_POSTBUILD_DIR}/${ScriptTargetName}.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${SCRIPT_POSTBUILD_DIR}/${ScriptTargetName}.dll_LOCK
|
||||
)
|
||||
else()
|
||||
add_custom_command(TARGET "script_${_name}" POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${SCRIPT_POSTBUILD_DIR}/$<TARGET_FILE:${ScriptTargetName}>_LOCK
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${ScriptTargetName}> ${SCRIPT_POSTBUILD_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${SCRIPT_POSTBUILD_DIR}/$<TARGET_FILE:${ScriptTargetName}>_LOCK
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -74,6 +74,10 @@ Sapphire::Scripting::ScriptInfo* Sapphire::Scripting::ScriptLoader::loadModule(
|
|||
fs::create_directories( cacheDir );
|
||||
fs::path dest( cacheDir /= f.filename().string() );
|
||||
|
||||
// make sure the module has finished building before trying to copy it
|
||||
if( fs::exists( f.string() + "_LOCK" ) )
|
||||
return nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
fs::copy_file( f, dest, fs::copy_options::overwrite_existing );
|
||||
|
|
Loading…
Add table
Reference in a new issue