Create the directory where resized textures will be cached.
This commit is contained in:
parent
03fbdc260d
commit
fac9cafa96
@ -192,6 +192,7 @@ FileManager::FileManager()
|
|||||||
checkAndCreateConfigDir();
|
checkAndCreateConfigDir();
|
||||||
checkAndCreateAddonsDir();
|
checkAndCreateAddonsDir();
|
||||||
checkAndCreateScreenshotDir();
|
checkAndCreateScreenshotDir();
|
||||||
|
checkAndCreateCachedTexturesDir();
|
||||||
checkAndCreateGPDir();
|
checkAndCreateGPDir();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -596,6 +597,14 @@ std::string FileManager::getScreenshotDir() const
|
|||||||
return m_screenshot_dir;
|
return m_screenshot_dir;
|
||||||
} // getScreenshotDir
|
} // getScreenshotDir
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Returns the directory in which resized textures should be cached.
|
||||||
|
*/
|
||||||
|
std::string FileManager::getCachedTexturesDir() const
|
||||||
|
{
|
||||||
|
return m_cached_textures_dir;
|
||||||
|
} // getCachedTexturesDir
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Returns the directory in which user-defined grand prix should be stored.
|
/** Returns the directory in which user-defined grand prix should be stored.
|
||||||
*/
|
*/
|
||||||
@ -852,6 +861,31 @@ void FileManager::checkAndCreateScreenshotDir()
|
|||||||
|
|
||||||
} // checkAndCreateScreenshotDir
|
} // checkAndCreateScreenshotDir
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Creates the directories for cached textures. This will set
|
||||||
|
* m_cached_textures_dir with the appropriate path.
|
||||||
|
*/
|
||||||
|
void FileManager::checkAndCreateCachedTexturesDir()
|
||||||
|
{
|
||||||
|
#if defined(WIN32) || defined(__CYGWIN__)
|
||||||
|
m_cached_textures_dir = m_user_config_dir + "resized-textures/";
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
m_cached_textures_dir = getenv("HOME");
|
||||||
|
m_cached_textures_dir += "/Library/Application Support/SuperTuxKart/ResizedTextures/";
|
||||||
|
#else
|
||||||
|
m_cached_textures_dir = checkAndCreateLinuxDir("XDG_CACHE_HOME", "supertuxkart", ".cache/", ".");
|
||||||
|
m_cached_textures_dir += "resized-textures/";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!checkAndCreateDirectory(m_cached_textures_dir))
|
||||||
|
{
|
||||||
|
Log::error("FileManager", "Can not create cached textures directory '%s', "
|
||||||
|
"falling back to '.'.", m_cached_textures_dir.c_str());
|
||||||
|
m_cached_textures_dir = ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // checkAndCreateCachedTexturesDir
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Creates the directories for user-defined grand prix. This will set m_gp_dir
|
/** Creates the directories for user-defined grand prix. This will set m_gp_dir
|
||||||
* with the appropriate path.
|
* with the appropriate path.
|
||||||
|
@ -72,6 +72,9 @@ private:
|
|||||||
/** Directory to store screenshots in. */
|
/** Directory to store screenshots in. */
|
||||||
std::string m_screenshot_dir;
|
std::string m_screenshot_dir;
|
||||||
|
|
||||||
|
/** Directory where resized textures are cached. */
|
||||||
|
std::string m_cached_textures_dir;
|
||||||
|
|
||||||
/** Directory where user-defined grand prix are stored. */
|
/** Directory where user-defined grand prix are stored. */
|
||||||
std::string m_gp_dir;
|
std::string m_gp_dir;
|
||||||
|
|
||||||
@ -91,6 +94,7 @@ private:
|
|||||||
bool isDirectory(const std::string &path) const;
|
bool isDirectory(const std::string &path) const;
|
||||||
void checkAndCreateAddonsDir();
|
void checkAndCreateAddonsDir();
|
||||||
void checkAndCreateScreenshotDir();
|
void checkAndCreateScreenshotDir();
|
||||||
|
void checkAndCreateCachedTexturesDir();
|
||||||
void checkAndCreateGPDir();
|
void checkAndCreateGPDir();
|
||||||
#if !defined(WIN32) && !defined(__CYGWIN__) && !defined(__APPLE__)
|
#if !defined(WIN32) && !defined(__CYGWIN__) && !defined(__APPLE__)
|
||||||
std::string checkAndCreateLinuxDir(const char *env_name,
|
std::string checkAndCreateLinuxDir(const char *env_name,
|
||||||
@ -110,6 +114,7 @@ public:
|
|||||||
XMLNode *createXMLTreeFromString(const std::string & content);
|
XMLNode *createXMLTreeFromString(const std::string & content);
|
||||||
|
|
||||||
std::string getScreenshotDir() const;
|
std::string getScreenshotDir() const;
|
||||||
|
std::string getCachedTexturesDir() const;
|
||||||
std::string getGPDir() const;
|
std::string getGPDir() const;
|
||||||
bool checkAndCreateDirectoryP(const std::string &path);
|
bool checkAndCreateDirectoryP(const std::string &path);
|
||||||
const std::string &getAddonsDir() const;
|
const std::string &getAddonsDir() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user