Fix regression in r59316

Different version could be passed here, added check
cached path is calculated with the proper one.
This commit is contained in:
Sergey Sharybin 2013-10-07 16:06:15 +00:00
parent 23440884fe
commit 098207e634

@ -74,13 +74,16 @@ const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir(int, const char *versionst
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir(int version, const char *versionstr) const
{
static string user_path = "";
static int last_version = 0;
/* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
* operator works we give a different path depending on the requested version */
if (version < 264) {
if (user_path.empty()) {
if (user_path.empty() || last_version != version) {
const char *home = getenv("HOME");
last_version = version;
if (home) {
user_path = string(home) + "/.blender/" + versionstr;
}
@ -91,9 +94,11 @@ const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir(int version, const char *ver
return (GHOST_TUns8 *)user_path.c_str();
}
else {
if (user_path.empty()) {
if (user_path.empty() || last_version != version) {
const char *home = getenv("XDG_CONFIG_HOME");
last_version = version;
if (home) {
user_path = string(home) + "/blender/" + versionstr;
}