Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-25 16:08:29 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-25 16:08:29 +0400
commit942fcf44150aea4eea8e0f44de6b05229bb7c182 (patch)
tree95737a1de510dcf9400a748eb0acfefaac651cdf /source/blender/blenlib/intern/path_util.c
parent81935ee6772afce569ddadc5ce5870728452b5d9 (diff)
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
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r--source/blender/blenlib/intern/path_util.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index ed3eedb8e10..3c7e66f280a 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -77,22 +77,6 @@
# endif
#endif /* WIN32 */
-/* standard paths */
-#ifdef WIN32
-# define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s"
-# define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s"
-#elif defined(__APPLE__)
-# define BLENDER_USER_FORMAT "%s/Blender/%s"
-# define BLENDER_SYSTEM_FORMAT "%s/Blender/%s"
-#else /* UNIX */
-# ifndef WITH_XDG_USER_DIRS /* oldschool unix ~/.blender/ */
-# define BLENDER_USER_FORMAT "%s/.blender/%s"
-# else /* new XDG ~/blender/.config/ */
-# define BLENDER_USER_FORMAT "%s/blender/%s"
-# endif // WITH_XDG_USER_DIRS
-# define BLENDER_SYSTEM_FORMAT "%s/blender/%s"
-#endif
-
/* local */
#define UNIQUE_NAME_MAX 128
@@ -822,16 +806,12 @@ void BLI_getlastdir(const char *dir, char *last, const size_t maxlen)
const char *BLI_getDefaultDocumentFolder(void)
{
#ifndef WIN32
+ const char *xdg_documents_dir= getenv("XDG_DOCUMENTS_DIR");
-#ifdef WITH_XDG_USER_DIRS
- const char *xdg_documents_dir = getenv("XDG_DOCUMENTS_DIR");
- if (xdg_documents_dir) {
+ if (xdg_documents_dir)
return xdg_documents_dir;
- }
-#endif
return getenv("HOME");
-
#else /* Windows */
static char documentfolder[MAXPATHLEN];
HRESULT hResult;
@@ -969,10 +949,9 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
}
}
- user_base_path = (const char *)GHOST_getUserDir();
- if (user_base_path) {
- BLI_snprintf(user_path, FILE_MAX, BLENDER_USER_FORMAT, user_base_path, blender_version_decimal(ver));
- }
+ user_base_path = (const char *)GHOST_getUserDir(ver, blender_version_decimal(ver));
+ if (user_base_path)
+ BLI_strncpy(user_path, user_base_path, FILE_MAX);
if (!user_path[0])
return 0;
@@ -1040,10 +1019,9 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
}
}
- system_base_path = (const char *)GHOST_getSystemDir();
- if (system_base_path) {
- BLI_snprintf(system_path, FILE_MAX, BLENDER_SYSTEM_FORMAT, system_base_path, blender_version_decimal(ver));
- }
+ system_base_path = (const char *)GHOST_getSystemDir(ver, blender_version_decimal(ver));
+ if (system_base_path)
+ BLI_strncpy(system_path, system_base_path, FILE_MAX);
if (!system_path[0])
return 0;