mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Added creation of es_settings.cfg on first application startup and improved media directory error handling.
This commit is contained in:
parent
29d2ccf201
commit
6028777be4
|
@ -409,6 +409,14 @@ int main(int argc, char* argv[])
|
||||||
// Always close the log on exit.
|
// Always close the log on exit.
|
||||||
atexit(&onExit);
|
atexit(&onExit);
|
||||||
|
|
||||||
|
// Check if the configuration file exists, and if not, create it.
|
||||||
|
// This should only happen on first application startup.
|
||||||
|
if (!Utils::FileSystem::exists(Utils::FileSystem::getHomePath() +
|
||||||
|
"/.emulationstation/es_settings.cfg")) {
|
||||||
|
LOG(LogInfo) << "Settings file es_settings.cfg does not exist, creating it...";
|
||||||
|
Settings::getInstance()->saveFile();
|
||||||
|
}
|
||||||
|
|
||||||
Window window;
|
Window window;
|
||||||
SystemScreenSaver screensaver(&window);
|
SystemScreenSaver screensaver(&window);
|
||||||
PowerSaver::init();
|
PowerSaver::init();
|
||||||
|
@ -492,6 +500,14 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the media directory exists, and if not, log a warning.
|
||||||
|
if (!Utils::FileSystem::isDirectory(FileData::getMediaDirectory()) ||
|
||||||
|
Utils::FileSystem::isSymlink(FileData::getMediaDirectory())) {
|
||||||
|
LOG(LogWarning) << "Warning - Games media directory does not exist "
|
||||||
|
"(or is not a directory or a symlink):";
|
||||||
|
LOG(LogWarning) << FileData::getMediaDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
// Generate joystick events since we're done loading.
|
// Generate joystick events since we're done loading.
|
||||||
SDL_JoystickEventState(SDL_ENABLE);
|
SDL_JoystickEventState(SDL_ENABLE);
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,14 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
||||||
if(it->existingMediaFile != "")
|
if(it->existingMediaFile != "")
|
||||||
Utils::FileSystem::removeFile(it->existingMediaFile);
|
Utils::FileSystem::removeFile(it->existingMediaFile);
|
||||||
|
|
||||||
|
// If the media directory does not exist, something is wrong, possibly permission
|
||||||
|
// problems or the MediaDirectory setting points to a file instead of a directory.
|
||||||
|
if (!Utils::FileSystem::isDirectory(Utils::FileSystem::getParent(filePath))) {
|
||||||
|
setError("Media directory does not exist and can't be created. "
|
||||||
|
"Permission problems?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
std::ofstream stream(Utils::String::stringToWideString(filePath).c_str(),
|
std::ofstream stream(Utils::String::stringToWideString(filePath).c_str(),
|
||||||
std::ios_base::out | std::ios_base::binary);
|
std::ios_base::out | std::ios_base::binary);
|
||||||
|
@ -337,6 +345,13 @@ void ImageDownloadHandle::update()
|
||||||
if(mExistingMediaFile != "")
|
if(mExistingMediaFile != "")
|
||||||
Utils::FileSystem::removeFile(mExistingMediaFile);
|
Utils::FileSystem::removeFile(mExistingMediaFile);
|
||||||
|
|
||||||
|
// If the media directory does not exist, something is wrong, possibly permission
|
||||||
|
// problems or the MediaDirectory setting points to a file instead of a directory.
|
||||||
|
if (!Utils::FileSystem::isDirectory(Utils::FileSystem::getParent(mSavePath))) {
|
||||||
|
setError("Media directory does not exist and can't be created. Permission problems?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
std::ofstream stream(Utils::String::stringToWideString(mSavePath).c_str(),
|
std::ofstream stream(Utils::String::stringToWideString(mSavePath).c_str(),
|
||||||
std::ios_base::out | std::ios_base::binary);
|
std::ios_base::out | std::ios_base::binary);
|
||||||
|
|
Loading…
Reference in a new issue