(Windows) Changed some log entries to use backslashes instead of forward slashes as directory separators

This commit is contained in:
Leon Styhre 2024-04-10 22:45:33 +02:00
parent 0c4db4156b
commit bcca5ca6e7

View file

@ -744,7 +744,12 @@ int main(int argc, char* argv[])
// Create the settings folder in the application data directory.
const std::string settingsDir {Utils::FileSystem::getAppDataDirectory() + "/settings"};
if (!Utils::FileSystem::isDirectory(settingsDir)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating settings directory \""
<< Utils::String::replace(settingsDir, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating settings directory \"" << settingsDir << "\"...";
#endif
Utils::FileSystem::createDirectory(settingsDir);
if (!Utils::FileSystem::isDirectory(settingsDir)) {
LOG(LogError) << "Couldn't create directory, permission problems?";
@ -819,7 +824,12 @@ int main(int argc, char* argv[])
// Create the gamelists folder in the application data directory.
const std::string gamelistsDir {Utils::FileSystem::getAppDataDirectory() + "/gamelists"};
if (!Utils::FileSystem::exists(gamelistsDir)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating gamelists directory \""
<< Utils::String::replace(gamelistsDir, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating gamelists directory \"" << gamelistsDir << "\"...";
#endif
Utils::FileSystem::createDirectory(gamelistsDir);
if (!Utils::FileSystem::exists(gamelistsDir)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";
@ -827,6 +837,23 @@ int main(int argc, char* argv[])
}
}
{
// Create the game media folder.
const std::string mediaDirectory {FileData::getMediaDirectory()};
if (!Utils::FileSystem::exists(mediaDirectory)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating game media directory \""
<< Utils::String::replace(mediaDirectory, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating game media directory \"" << mediaDirectory << "\"...";
#endif
Utils::FileSystem::createDirectory(mediaDirectory);
if (!Utils::FileSystem::exists(mediaDirectory)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";
}
}
}
{
#if defined(__ANDROID__)
const std::string themeDir {Utils::FileSystem::getAppDataDirectory() + "/themes"};
@ -861,8 +888,12 @@ int main(int argc, char* argv[])
userThemeDirectory = userThemeDirSetting;
if (!Utils::FileSystem::exists(userThemeDirectory)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating themes directory \""
<< Utils::String::replace(userThemeDirectory, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating themes directory \"" << userThemeDirectory << "\"...";
#endif
Utils::FileSystem::createDirectory(userThemeDirectory);
if (!Utils::FileSystem::exists(userThemeDirectory)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";
@ -871,18 +902,6 @@ int main(int argc, char* argv[])
#endif
}
{
// Create the game media folder.
const std::string mediaDirectory {FileData::getMediaDirectory()};
if (!Utils::FileSystem::exists(mediaDirectory)) {
LOG(LogInfo) << "Creating game media directory \"" << mediaDirectory << "\"...";
Utils::FileSystem::createDirectory(mediaDirectory);
if (!Utils::FileSystem::exists(mediaDirectory)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";
}
}
}
{
#if defined(__ANDROID__)
const std::string mediaDirectory {FileData::getMediaDirectory()};
@ -903,7 +922,12 @@ int main(int argc, char* argv[])
// for custom event scripts so it's also created as a convenience.
const std::string scriptsDir {Utils::FileSystem::getAppDataDirectory() + "/scripts"};
if (!Utils::FileSystem::exists(scriptsDir)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating scripts directory \""
<< Utils::String::replace(scriptsDir, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating scripts directory \"" << scriptsDir << "\"...";
#endif
Utils::FileSystem::createDirectory(scriptsDir);
if (!Utils::FileSystem::exists(scriptsDir)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";
@ -918,7 +942,12 @@ int main(int argc, char* argv[])
const std::string slideshowDir {Utils::FileSystem::getAppDataDirectory() +
"/screensavers/custom_slideshow"};
if (!Utils::FileSystem::exists(screensaversDir)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating screensavers directory \""
<< Utils::String::replace(screensaversDir, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating screensavers directory \"" << screensaversDir << "\"...";
#endif
Utils::FileSystem::createDirectory(screensaversDir);
if (!Utils::FileSystem::exists(screensaversDir)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";
@ -935,7 +964,12 @@ int main(int argc, char* argv[])
}
#endif
if (!Utils::FileSystem::exists(slideshowDir)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating custom_slideshow directory \""
<< Utils::String::replace(slideshowDir, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating custom_slideshow directory \"" << slideshowDir << "\"...";
#endif
Utils::FileSystem::createDirectory(slideshowDir);
if (!Utils::FileSystem::exists(slideshowDir)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";
@ -949,7 +983,12 @@ int main(int argc, char* argv[])
const std::string controllersDir {Utils::FileSystem::getAppDataDirectory() +
"/controllers"};
if (!Utils::FileSystem::exists(controllersDir)) {
#if defined(_WIN64)
LOG(LogInfo) << "Creating controllers directory \""
<< Utils::String::replace(controllersDir, "/", "\\") << "\"...";
#else
LOG(LogInfo) << "Creating controllers directory \"" << controllersDir << "\"...";
#endif
Utils::FileSystem::createDirectory(controllersDir);
if (!Utils::FileSystem::exists(controllersDir)) {
LOG(LogWarning) << "Couldn't create directory, permission problems?";