MCPcopy Create free account
hub / github.com/SpartanJ/eepp / onFileSystemEvent

Method onFileSystemEvent

src/tools/ecode/plugins/plugin.cpp:86–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void Plugin::onFileSystemEvent( const FileEvent& ev, const FileInfo& file ) {
87 if ( ev.type != FileSystemEventType::Modified || mShuttingDown || isLoading() )
88 return;
89
90 if ( file.getFilepath() != mConfigPath ||
91 file.getModificationTime() == mConfigFileInfo.getModificationTime() )
92 return;
93
94 std::string fileContents;
95 FileSystem::fileGet( file.getFilepath(), fileContents );
96 if ( getConfigFileHash() != String::hash( fileContents ) ) {
97 if ( mManager->isPluginReloadEnabled() && !isLoading() && isReady() ) {
98 mConfigFileInfo = file;
99 unsubscribeFileSystemListener();
100 mManager->reload( getId() );
101 } else {
102 Log::debug( "Plugin %s: Configuration file has been modified: %s. But "
103 "plugin reload is not enabled.",
104 getTitle().c_str(), mConfigPath.c_str() );
105 }
106 } else {
107 Log::debug( "Plugin %s: Configuration file has been modified: %s. But contents "
108 "are the same.",
109 getTitle().c_str(), mConfigPath.c_str() );
110 }
111}
112
113void Plugin::setReady( Time loadTime ) {
114 if ( mReady ) {

Callers 1

Calls 5

hashFunction · 0.85
debugFunction · 0.85
isPluginReloadEnabledMethod · 0.80
c_strMethod · 0.80
reloadMethod · 0.45

Tested by

no test coverage detected