| 48 | |
| 49 | |
| 50 | bool Gui::init(std::string resFolder) { |
| 51 | resourceFolder = resFolder; |
| 52 | |
| 53 | client = new NymphCastClient; |
| 54 | |
| 55 | if (resFolder.empty()) { |
| 56 | //if (!Utils::FileSystem::exists(configDir)) { |
| 57 | // |
| 58 | //} |
| 59 | |
| 60 | // If ~/.emulationstation doesn't exist and cannot be created, return false; |
| 61 | if (!verifyHomeFolderExists()) { |
| 62 | // Clear home folder setting. |
| 63 | Utils::FileSystem::setHomePath(resFolder); |
| 64 | |
| 65 | // Set home path. |
| 66 | // Use this setting if home folder doesn't contain the .emulationstation folder? |
| 67 | std::string exepath = Utils::FileSystem::getCWDPath(); |
| 68 | |
| 69 | LOG(LogInfo) << "Attempt to use CWD path: " << exepath; |
| 70 | Utils::FileSystem::setExePath(exepath); |
| 71 | } |
| 72 | } |
| 73 | else { |
| 74 | LOG(LogInfo) << "Setting exe path to: " << resFolder; |
| 75 | Utils::FileSystem::setExePath(resFolder); |
| 76 | } |
| 77 | |
| 78 | window = new Window; |
| 79 | screensaver = new SystemScreenSaver(window); |
| 80 | PowerSaver::init(); |
| 81 | ViewController::init(window); |
| 82 | CollectionSystemManager::init(window); |
| 83 | MameNames::init(); |
| 84 | window->pushGui(ViewController::get()); |
| 85 | |
| 86 | if (!window->init()) { |
| 87 | LOG(LogError) << "Window failed to initialize!"; |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | bool splashScreen = Settings::getInstance()->getBool("SplashScreen"); |
| 92 | bool splashScreenProgress = Settings::getInstance()->getBool("SplashScreenProgress"); |
| 93 | if (splashScreen) { |
| 94 | std::string progressText = "Loading..."; |
| 95 | if (splashScreenProgress) { |
| 96 | progressText = "Loading system config..."; |
| 97 | } |
| 98 | |
| 99 | window->renderLoadingScreen(progressText); |
| 100 | } |
| 101 | |
| 102 | if (!SystemData::loadConfig(window)) { |
| 103 | LOG(LogError) << "Error while parsing systems configuration file!"; |
| 104 | return false; |
| 105 | } |
| 106 | |
| 107 | if (SystemData::sSystemVector.size() == 0) { |
nothing calls this directly
no test coverage detected