From e99d7592fb035f54edd66450999550b8e457db04 Mon Sep 17 00:00:00 2001 From: auria Date: Thu, 1 Jul 2010 18:11:22 +0000 Subject: [PATCH] Fixed uglyness on OS X where directories called both SuperTuxKart and supertuxkart would be attempted to be created in App Support git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5615 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/io/file_manager.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/io/file_manager.cpp b/src/io/file_manager.cpp index eb045c760..a58c0e3f4 100644 --- a/src/io/file_manager.cpp +++ b/src/io/file_manager.cpp @@ -380,7 +380,7 @@ bool FileManager::checkAndCreateDirectory(const std::string &path) /** Checks if the config directory exists, and it not, tries to create it. */ void FileManager::checkAndCreateConfigDir() { -#ifdef WIN32 +#if defined(WIN32) // Try to use the APPDATA directory to store config files and highscore // lists. If not defined, used the current directory. if(getenv("APPDATA")!=NULL) @@ -395,8 +395,11 @@ void FileManager::checkAndCreateConfigDir() } else m_config_dir = "."; -#else -# ifdef __APPLE__ + const std::string CONFIGDIR("supertuxkart"); + + m_config_dir += "/"; + m_config_dir += CONFIGDIR; +#elif defined(__APPLE__) if (getenv("HOME")!=NULL) { m_config_dir = getenv("HOME"); @@ -408,6 +411,8 @@ void FileManager::checkAndCreateConfigDir() m_config_dir = ""; } m_config_dir += "/Library/Application Support/"; + const std::string CONFIGDIR("SuperTuxKart"); + m_config_dir += CONFIGDIR; # else // Remaining unix variants. Use the new standards for config directory // i.e. either XDG_CONFIG_HOME or $HOME/.config @@ -432,12 +437,12 @@ void FileManager::checkAndCreateConfigDir() m_config_dir += "."; } } -# endif -#endif const std::string CONFIGDIR("supertuxkart"); - + m_config_dir += "/"; m_config_dir += CONFIGDIR; +#endif + if(!checkAndCreateDirectory(m_config_dir)) { fprintf(stderr, "Can not create config dir '%s', falling back to '.'.\n",