| 51 | } |
| 52 | |
| 53 | ResourceBase ResourceManager::load(const Torque::Path &path) |
| 54 | { |
| 55 | #ifdef TORQUE_DEBUG_RES_MANAGER |
| 56 | Con::printf( "ResourceManager::load : [%s]", path.getFullPath().c_str() ); |
| 57 | #endif |
| 58 | |
| 59 | ResourceHeaderMap::Iterator iter = mResourceHeaderMap.findOrInsert( path.getFullPath() ); |
| 60 | |
| 61 | ResourceHeaderMap::Pair &pair = *iter; |
| 62 | |
| 63 | if ( pair.value == NULL ) |
| 64 | { |
| 65 | pair.value = new ResourceBase::Header; |
| 66 | |
| 67 | // TODO: This can fail if the file doesn't exist |
| 68 | // at all which is possible. |
| 69 | // |
| 70 | // The problem is the templated design in ResourceManager |
| 71 | // keeps me from checking to see if the resource load failed |
| 72 | // before adding a notification. |
| 73 | // |
| 74 | // IMO the resource manager is overly templateized and |
| 75 | // we should refactor it so that its not so. |
| 76 | // |
| 77 | FS::AddChangeNotification( path, this, &ResourceManager::notifiedFileChanged ); |
| 78 | } |
| 79 | |
| 80 | ResourceBase::Header *header = pair.value; |
| 81 | |
| 82 | if (header->getSignature() == 0) |
| 83 | header->mPath = path; |
| 84 | |
| 85 | return ResourceBase( header ); |
| 86 | } |
| 87 | |
| 88 | ResourceBase ResourceManager::find(const Torque::Path &path) |
| 89 | { |
nothing calls this directly
no test coverage detected