| 105 | } |
| 106 | |
| 107 | void Doom3FileSystem::initialise(const SearchPaths& vfsSearchPaths, const std::set<std::string>& allowedExtensions) |
| 108 | { |
| 109 | // Check if the new configuration is any different then the current one |
| 110 | if (!vfsSearchPaths.empty() && vfsSearchPaths == _vfsSearchPaths && allowedExtensions == _allowedExtensions) |
| 111 | { |
| 112 | rMessage() << "VFS::initialise call has identical arguments as current setup, won't do anything." << std::endl; |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | if (isInitialised()) |
| 117 | { |
| 118 | // We've been initialised with some paths already, shutdown first |
| 119 | shutdown(); |
| 120 | } |
| 121 | |
| 122 | _vfsSearchPaths = vfsSearchPaths; |
| 123 | _allowedExtensions = allowedExtensions; |
| 124 | |
| 125 | rMessage() << "Initialising filesystem using " << _vfsSearchPaths.size() << " paths " << std::endl; |
| 126 | rMessage() << "VFS Search Path priority is: \n- " << string::join(_vfsSearchPaths, "\n- ") << std::endl; |
| 127 | |
| 128 | rMessage() << "Allowed PK4 Archive File Extensions: " << string::join(_allowedExtensions, ", ") << std::endl; |
| 129 | |
| 130 | // Build list of dir extensions, e.g. pk4 -> pk4dir |
| 131 | for (const std::string& allowedExtension : _allowedExtensions) |
| 132 | { |
| 133 | _allowedExtensionsDir.insert(allowedExtension + "dir"); |
| 134 | } |
| 135 | |
| 136 | // Initialise the paths, in the given order |
| 137 | for (const std::string& path : _vfsSearchPaths) |
| 138 | { |
| 139 | initDirectory(path); |
| 140 | } |
| 141 | |
| 142 | signal_Initialised().emit(); |
| 143 | } |
| 144 | |
| 145 | bool Doom3FileSystem::isInitialised() const |
| 146 | { |