void OculusWorldDemoApp::InitMainFilePath() { // We try alternative relative locations for the file. const String contentBase = pPlatform->GetContentDirectory() + "/" + WORLDDEMO_ASSET_PATH; const char* baseDirectories[] = { "", contentBase.ToCStr(), #ifdef SHRDIR #define STR1(x) #x #define STR(x) STR1(x) STR(SHRDIR) "/OculusWorldDemo/Assets/Tuscany/" #endif }; String newPath; for(size_t i = 0; i < OVR_ARRAY_COUNT(baseDirectories); ++i) { newPath = baseDirectories[i]; newPath += WORLDDEMO_ASSET_FILE; OVR_DEBUG_LOG(("Trying to load the scene at: %s...", newPath.ToCStr())); if (SysFile(newPath).IsValid()) { OVR_DEBUG_LOG(("Success loading %s", newPath.ToCStr())); MainFilePath = newPath; return; } } OVR_DEBUG_LOG(("Unable to find any version of %s. Do you have your working directory set right?", WORLDDEMO_ASSET_FILE)); }
void OculusWorldDemoApp::InitMainFilePath() { MainFilePath = WORLDDEMO_ASSET_FILE; // Try to modify path for correctness in case specified file is not found. if (!SysFile(MainFilePath).IsValid()) { String prefixPath1(pPlatform->GetContentDirectory() + "/" + WORLDDEMO_ASSET_PATH1), prefixPath2(WORLDDEMO_ASSET_PATH2), prefixPath3(WORLDDEMO_ASSET_PATH3), prefixPath4(WORLDDEMO_ASSET_PATH4); if (SysFile(prefixPath1 + MainFilePath).IsValid()) MainFilePath = prefixPath1 + MainFilePath; else if (SysFile(prefixPath2 + MainFilePath).IsValid()) MainFilePath = prefixPath2 + MainFilePath; else if (SysFile(prefixPath3 + MainFilePath).IsValid()) MainFilePath = prefixPath3 + MainFilePath; else if (SysFile(prefixPath4 + MainFilePath).IsValid()) MainFilePath = prefixPath4 + MainFilePath; } }