| 84 | } |
| 85 | |
| 86 | void 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 | |
| 113 | void Plugin::setReady( Time loadTime ) { |
| 114 | if ( mReady ) { |
no test coverage detected