MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / validatePath

Function validatePath

TheForceEngine/main.cpp:477–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475}
476
477bool validatePath()
478{
479 if (!TFE_Paths::hasPath(PATH_SOURCE_DATA)) { return false; }
480
481 char testFile[TFE_MAX_PATH];
482 // if (game->id == Game_Dark_Forces)
483 {
484 // Does DARK.GOB exist?
485 sprintf(testFile, "%s%s", TFE_Paths::getPath(PATH_SOURCE_DATA), "DARK.GOB");
486 if (!FileUtil::exists(testFile))
487 {
488 TFE_System::logWrite(LOG_ERROR, "Main", "Invalid game source path: '%s' - '%s' does not exist.", TFE_Paths::getPath(PATH_SOURCE_DATA), testFile);
489 TFE_Paths::setPath(PATH_SOURCE_DATA, "");
490 }
491 else if (!GobArchive::validate(testFile, 130))
492 {
493 TFE_System::logWrite(LOG_ERROR, "Main", "Invalid game source path: '%s' - '%s' GOB is invalid, too few files.", TFE_Paths::getPath(PATH_SOURCE_DATA), testFile);
494 TFE_Paths::setPath(PATH_SOURCE_DATA, "");
495 }
496 }
497 return TFE_Paths::hasPath(PATH_SOURCE_DATA);
498}
499
500int main(int argc, char* argv[])
501{

Callers 2

setAppStateFunction · 0.70
mainFunction · 0.70

Calls 5

logWriteFunction · 0.85
hasPathFunction · 0.50
getPathFunction · 0.50
existsFunction · 0.50
setPathFunction · 0.50

Tested by

no test coverage detected