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
This commit is contained in:
auria 2010-07-01 18:11:22 +00:00
parent 58d8e91e20
commit e99d7592fb

View File

@ -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",