mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 22:17:45 +00:00
fix hotloading setting, minor cleanup
This commit is contained in:
parent
1cbfccb1b3
commit
59e5a3a7f1
4 changed files with 5 additions and 4 deletions
|
@ -13,7 +13,7 @@
|
||||||
<CachePath>./cache/</CachePath>
|
<CachePath>./cache/</CachePath>
|
||||||
|
|
||||||
<HotSwap>
|
<HotSwap>
|
||||||
<Enabled>1</Enabled>
|
<Enabled>true</Enabled>
|
||||||
<ScriptsDir>../scripts/native/</ScriptsDir>
|
<ScriptsDir>../scripts/native/</ScriptsDir>
|
||||||
<BuildDir>../cmake-build-debug/</BuildDir>
|
<BuildDir>../cmake-build-debug/</BuildDir>
|
||||||
<BuildCmd>cmake --build %1% --target %2%</BuildCmd>
|
<BuildCmd>cmake --build %1% --target %2%</BuildCmd>
|
||||||
|
|
|
@ -40,8 +40,6 @@ namespace Scripting {
|
||||||
const std::string getModuleExtension();
|
const std::string getModuleExtension();
|
||||||
bool isModuleLoaded( const std::string& name );
|
bool isModuleLoaded( const std::string& name );
|
||||||
|
|
||||||
// todo: use some template magic (type_traits is_same?) to avoid ScriptType param
|
|
||||||
// not sure if worthwhile given that it adds an extra place where script types need to be managed
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
T* getScript( uint32_t scriptId )
|
T* getScript( uint32_t scriptId )
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,6 @@ namespace Scripting {
|
||||||
|
|
||||||
ModuleHandle handle;
|
ModuleHandle handle;
|
||||||
std::vector< ScriptObject* > scripts;
|
std::vector< ScriptObject* > scripts;
|
||||||
std::size_t type;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,10 @@ bool Core::Scripting::ScriptManager::init()
|
||||||
|
|
||||||
void Core::Scripting::ScriptManager::watchDirectories()
|
void Core::Scripting::ScriptManager::watchDirectories()
|
||||||
{
|
{
|
||||||
|
auto shouldWatch = g_serverZone.getConfig()->getValue< bool >( "Settings.General.Scripts.HotSwap.Enabled", true );
|
||||||
|
if( !shouldWatch )
|
||||||
|
return;
|
||||||
|
|
||||||
Watchdog::watchMany( g_serverZone.getConfig()->getValue< std::string >( "Settings.General.Scripts.Path", "./compiledscripts/" ) + "*" + m_nativeScriptManager->getModuleExtension(),
|
Watchdog::watchMany( g_serverZone.getConfig()->getValue< std::string >( "Settings.General.Scripts.Path", "./compiledscripts/" ) + "*" + m_nativeScriptManager->getModuleExtension(),
|
||||||
[ this ]( const std::vector< ci::fs::path >& paths )
|
[ this ]( const std::vector< ci::fs::path >& paths )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue