MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / setFolders

Function setFolders

src/Engine/Options.cpp:423–463  ·  view source on GitHub ↗

* Sets up the game's Data folder where the data files * are loaded from and the User folder and Config * folder where settings and saves are stored in. */

Source from the content-addressed store, hash-verified

421 * folder where settings and saves are stored in.
422 */
423void setFolders()
424{
425 _dataList = CrossPlatform::findDataFolders();
426 if (_dataFolder != "")
427 {
428 _dataList.insert(_dataList.begin(), _dataFolder);
429 }
430 if (_userFolder == "")
431 {
432 std::vector<std::string> user = CrossPlatform::findUserFolders();
433 _configFolder = CrossPlatform::findConfigFolder();
434
435 // Look for an existing user folder
436 for (std::vector<std::string>::iterator i = user.begin(); i != user.end(); ++i)
437 {
438 if (CrossPlatform::folderExists(*i))
439 {
440 _userFolder = *i;
441 break;
442 }
443 }
444
445 // Set up folders
446 if (_userFolder == "")
447 {
448 for (std::vector<std::string>::iterator i = user.begin(); i != user.end(); ++i)
449 {
450 if (CrossPlatform::createFolder(*i))
451 {
452 _userFolder = *i;
453 break;
454 }
455 }
456 }
457 }
458
459 if (_configFolder == "")
460 {
461 _configFolder = _userFolder;
462 }
463}
464
465/**
466 * Updates the game's options with those in the configuation

Callers 1

initFunction · 0.85

Calls 5

findDataFoldersFunction · 0.85
findUserFoldersFunction · 0.85
findConfigFolderFunction · 0.85
folderExistsFunction · 0.85
createFolderFunction · 0.85

Tested by

no test coverage detected