| 198 | } |
| 199 | |
| 200 | void FileSystemChangeNotifier::internalNotifyDirChanged( const Path &dir ) |
| 201 | { |
| 202 | DirMap::Iterator itr = mDirMap.find( dir ); |
| 203 | if ( itr == mDirMap.end() ) |
| 204 | return; |
| 205 | |
| 206 | // Gather the changed file info. |
| 207 | FileInfoList changedList; |
| 208 | FileInfoList &fileList = itr->value; |
| 209 | for ( U32 i = 0; i < fileList.getSize(); i++ ) |
| 210 | { |
| 211 | FileInfo &fInfo = fileList[i]; |
| 212 | |
| 213 | FileNode::Attributes attr; |
| 214 | bool success = GetFileAttributes(fInfo.filePath, &attr); |
| 215 | |
| 216 | // Ignore the file if we couldn't get the attributes (it must have |
| 217 | // been deleted) or the last modification time isn't newer. |
| 218 | if ( !success || attr.mtime <= fInfo.savedLastModTime ) |
| 219 | continue; |
| 220 | |
| 221 | // Store the new mod time. |
| 222 | fInfo.savedLastModTime = attr.mtime; |
| 223 | |
| 224 | // We're taking a copy of the FileInfo struct here so that the |
| 225 | // callback can safely remove the notification without crashing. |
| 226 | changedList.pushBack( fInfo ); |
| 227 | } |
| 228 | |
| 229 | // Now signal all the changed files. |
| 230 | for ( U32 i = 0; i < changedList.getSize(); i++ ) |
| 231 | { |
| 232 | FileInfo &fInfo = changedList[i]; |
| 233 | |
| 234 | Con::warnf( " : file changed [%s]", fInfo.filePath.getFullPath().c_str() ); |
| 235 | fInfo.signal.trigger( fInfo.filePath ); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | //----------------------------------------------------------------------------- |
| 240 | |