[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47013] trunk/blender: Unix: enable use of XDG paths for storing Blender configuration on Linux/BSD/..,
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri May 25 14:08:31 CEST 2012
Revision: 47013
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47013
Author: blendix
Date: 2012-05-25 12:08:29 +0000 (Fri, 25 May 2012)
Log Message:
-----------
Unix: enable use of XDG paths for storing Blender configuration on Linux/BSD/..,
starting from version 2.64. Unless you have a special system setup, this means the
will be in ~/.config/blender rather than ~/.blender.
When the version number is changed to 2.64, the "Copy Previous Settings" operator
in the splash will copy the settings to the new location.
XDG base directory specification:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Modified Paths:
--------------
trunk/blender/CMakeLists.txt
trunk/blender/intern/ghost/CMakeLists.txt
trunk/blender/intern/ghost/GHOST_ISystemPaths.h
trunk/blender/intern/ghost/GHOST_Path-api.h
trunk/blender/intern/ghost/intern/GHOST_Path-api.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemPaths.h
trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.h
trunk/blender/intern/ghost/intern/GHOST_SystemPathsCocoa.h
trunk/blender/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
trunk/blender/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemPathsWin32.h
trunk/blender/intern/ghost/intern/GHOST_SystemPathsX11.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemPathsX11.h
trunk/blender/source/blender/blenlib/CMakeLists.txt
trunk/blender/source/blender/blenlib/intern/path_util.c
Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/CMakeLists.txt 2012-05-25 12:08:29 UTC (rev 47013)
@@ -161,8 +161,6 @@
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
- option(WITH_XDG_USER_DIRS "Build with XDG Base Directory Specification (only config and documents for now)" OFF)
- mark_as_advanced(WITH_XDG_USER_DIRS)
# freebsd doesn't seems to support XDND
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
Modified: trunk/blender/intern/ghost/CMakeLists.txt
===================================================================
--- trunk/blender/intern/ghost/CMakeLists.txt 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/CMakeLists.txt 2012-05-25 12:08:29 UTC (rev 47013)
@@ -108,10 +108,6 @@
)
endif()
-if(WITH_XDG_USER_DIRS)
- add_definitions(-DWITH_XDG_USER_DIRS)
-endif()
-
if(WITH_HEADLESS OR WITH_GHOST_SDL)
if(WITH_HEADLESS)
list(APPEND SRC
Modified: trunk/blender/intern/ghost/GHOST_ISystemPaths.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystemPaths.h 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/GHOST_ISystemPaths.h 2012-05-25 12:08:29 UTC (rev 47013)
@@ -72,17 +72,17 @@
public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
- * "unpack and run" path, then look for properly installed path, not including versioning.
+ * "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual const GHOST_TUns8 *getSystemDir() const = 0;
+ virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
/**
- * Determine the base dir in which user configuration is stored, not including versioning.
+ * Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- virtual const GHOST_TUns8 *getUserDir() const = 0;
+ virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine the directory of the current binary
Modified: trunk/blender/intern/ghost/GHOST_Path-api.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_Path-api.h 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/GHOST_Path-api.h 2012-05-25 12:08:29 UTC (rev 47013)
@@ -55,16 +55,16 @@
/**
* Determine the base dir in which shared resources are located. It will first try to use
- * "unpack and run" path, then look for properly installed path, not including versioning.
+ * "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
-extern const GHOST_TUns8 *GHOST_getSystemDir(void);
+extern const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr);
/**
- * Determine the base dir in which user configuration is stored, not including versioning.
+ * Determine the base dir in which user configuration is stored, including versioning.
* @return Unsigned char string pointing to user dir (eg ~).
*/
-extern const GHOST_TUns8 *GHOST_getUserDir(void);
+extern const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr);
/**
Modified: trunk/blender/intern/ghost/intern/GHOST_Path-api.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_Path-api.cpp 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/intern/GHOST_Path-api.cpp 2012-05-25 12:08:29 UTC (rev 47013)
@@ -45,16 +45,16 @@
return GHOST_ISystemPaths::dispose();
}
-const GHOST_TUns8 *GHOST_getSystemDir()
+const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
- return systemPaths ? systemPaths->getSystemDir() : 0;
+ return systemPaths ? systemPaths->getSystemDir(version, versionstr) : 0;
}
-const GHOST_TUns8 *GHOST_getUserDir()
+const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
- return systemPaths ? systemPaths->getUserDir() : 0; /* shouldn't be NULL */
+ return systemPaths ? systemPaths->getUserDir(version, versionstr) : 0; /* shouldn't be NULL */
}
const GHOST_TUns8 *GHOST_getBinaryDir()
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemPaths.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemPaths.h 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemPaths.h 2012-05-25 12:08:29 UTC (rev 47013)
@@ -52,17 +52,17 @@
/**
* Determine the base dir in which shared resources are located. It will first try to use
- * "unpack and run" path, then look for properly installed path, not including versioning.
+ * "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual const GHOST_TUns8 *getSystemDir() const = 0;
+ virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
- /**
- * Determine the base dir in which user configuration is stored, not including versioning.
- * If needed, it will create the base directory.
- * @return Unsigned char string pointing to user dir (eg ~/.blender/).
- */
- virtual const GHOST_TUns8 *getUserDir() const = 0;
+ /**
+ * Determine the base dir in which user configuration is stored, including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+ virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine the directory of the current binary
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp 2012-05-25 12:08:29 UTC (rev 47013)
@@ -44,21 +44,23 @@
{
}
-const GHOST_TUns8 *GHOST_SystemPathsCarbon::getSystemDir() const
+const GHOST_TUns8 *GHOST_SystemPathsCarbon::getSystemDir(int, const char *versionstr) const
{
- return (GHOST_TUns8 *)"/Library/Application Support";
+ static char systemPath[1024];
+
+ snprintf(systemPath, sizeof(systemPath), "/Library/Application Support/Blender/%s", versionstr);
+
+ return (GHOST_TUns8*)systemPath;
}
-const GHOST_TUns8 *GHOST_SystemPathsCarbon::getUserDir() const
+const GHOST_TUns8 *GHOST_SystemPathsCarbon::getUserDir(int, const char *versionstr) const
{
- static char usrPath[256] = "";
+ static char usrPath[1024];
char *env = getenv("HOME");
if (env) {
- strncpy(usrPath, env, 245);
- usrPath[245] = 0;
- strcat(usrPath, "/Library/Application Support");
- return (GHOST_TUns8 *) usrPath;
+ snprintf(usrPath, sizeof(usrPath), "%s/Library/Application Support/Blender/%s", env, versionstr);
+ return (GHOST_TUns8*)usrPath;
}
else
return NULL;
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.h 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.h 2012-05-25 12:08:29 UTC (rev 47013)
@@ -60,17 +60,17 @@
/**
* Determine the base dir in which shared resources are located. It will first try to use
- * "unpack and run" path, then look for properly installed path, not including versioning.
+ * "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual const GHOST_TUns8 *getSystemDir() const;
+ virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
- * Determine the base dir in which user configuration is stored, not including versioning.
+ * Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- virtual const GHOST_TUns8 *getUserDir() const;
+ virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine the directory of the current binary
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemPathsCocoa.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemPathsCocoa.h 2012-05-25 12:06:10 UTC (rev 47012)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemPathsCocoa.h 2012-05-25 12:08:29 UTC (rev 47013)
@@ -54,17 +54,17 @@
/**
* Determine the base dir in which shared resources are located. It will first try to use
- * "unpack and run" path, then look for properly installed path, not including versioning.
+ * "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual const GHOST_TUns8 *getSystemDir() const;
+ virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
- * Determine the base dir in which user configuration is stored, not including versioning.
+ * Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- virtual const GHOST_TUns8 *getUserDir() const;
+ virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list