| 201 | } |
| 202 | |
| 203 | void PopulateAssets() { |
| 204 | using namespace boost::filesystem; |
| 205 | |
| 206 | path basePath(RESOURCE_PATH); |
| 207 | bool hasLanes = false; |
| 208 | bool hasMisc = false; |
| 209 | bool hasSfx = false; |
| 210 | |
| 211 | for (directory_iterator itr(basePath); itr != directory_iterator(); ++itr) { |
| 212 | NeedForSpeed currentNFS; |
| 213 | currentNFS.tag = UNKNOWN; |
| 214 | |
| 215 | if (itr->path().filename().string().find(ToString(NFS_2_SE)) != std::string::npos) { |
| 216 | currentNFS.tag = NFS_2_SE; |
| 217 | |
| 218 | std::stringstream trackBasePathStream; |
| 219 | trackBasePathStream << itr->path().string() << NFS_2_SE_TRACK_PATH; |
| 220 | std::string trackBasePath(trackBasePathStream.str()); |
| 221 | ASSERT(exists(trackBasePath), |
| 222 | "NFS 2 Special Edition track folder: " << trackBasePath << " is missing."); |
| 223 | |
| 224 | for (directory_iterator trackItr(trackBasePath); trackItr != directory_iterator(); ++trackItr) { |
| 225 | if (trackItr->path().filename().string().find(".TRK") != std::string::npos) { |
| 226 | currentNFS.tracks.emplace_back(trackItr->path().filename().replace_extension("").string()); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | std::stringstream carBasePathStream; |
| 231 | carBasePathStream << itr->path().string() << NFS_2_SE_CAR_PATH; |
| 232 | std::string carBasePath(carBasePathStream.str()); |
| 233 | ASSERT(exists(carBasePath), "NFS 2 Special Edition car folder: " << carBasePath << " is missing."); |
| 234 | |
| 235 | // TODO: Work out where NFS2 SE Cars are stored |
| 236 | } else if (itr->path().filename().string().find(ToString(NFS_2)) != std::string::npos) { |
| 237 | currentNFS.tag = NFS_2; |
| 238 | |
| 239 | std::stringstream trackBasePathStream; |
| 240 | trackBasePathStream << itr->path().string() << NFS_2_TRACK_PATH; |
| 241 | std::string trackBasePath(trackBasePathStream.str()); |
| 242 | ASSERT(exists(trackBasePath), "NFS 2 track folder: " << trackBasePath << " is missing."); |
| 243 | |
| 244 | for (directory_iterator trackItr(trackBasePath); trackItr != directory_iterator(); ++trackItr) { |
| 245 | if (trackItr->path().filename().string().find(".TRK") != std::string::npos) { |
| 246 | currentNFS.tracks.emplace_back(trackItr->path().filename().replace_extension("").string()); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | std::stringstream carBasePathStream; |
| 251 | carBasePathStream << itr->path().string() << NFS_2_CAR_PATH; |
| 252 | std::string carBasePath(carBasePathStream.str()); |
| 253 | ASSERT(exists(carBasePath), "NFS 2 car folder: " << carBasePath << " is missing."); |
| 254 | |
| 255 | for (directory_iterator carItr(carBasePath); carItr != directory_iterator(); ++carItr) { |
| 256 | if (carItr->path().filename().string().find(".GEO") != std::string::npos) { |
| 257 | currentNFS.cars.emplace_back(carItr->path().filename().replace_extension("").string()); |
| 258 | } |
| 259 | } |
| 260 | } else if (itr->path().filename().string().find(ToString(NFS_3_PS1)) != std::string::npos) { |
nothing calls this directly
no outgoing calls
no test coverage detected