diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-03 03:16:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-03 03:16:10 +0400 |
commit | 5fbf3b813cd5473070f3c3bd6572ad504b83dc74 (patch) | |
tree | f9cb28d79cf31d8ea85014ef5d70c80190fb3333 /source/blender/blenlib | |
parent | 439f57d361322bbe521cfd3e60dfd6534ca22c6d (diff) | |
parent | 4293f4738ce0ea1bb81260b12a6b64f98b6a3468 (diff) |
svn merge -r41458:41480 ^/trunk/blender
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_callbacks.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 61 |
3 files changed, 40 insertions, 27 deletions
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index 5322ce04a2e..7e4fad54cda 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -47,6 +47,8 @@ typedef enum { BLI_CB_EVT_LOAD_POST, BLI_CB_EVT_SAVE_PRE, BLI_CB_EVT_SAVE_POST, + BLI_CB_EVT_SCENE_UPDATE_PRE, + BLI_CB_EVT_SCENE_UPDATE_POST, BLI_CB_EVT_TOT } eCbEvent; diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 2f6b6f7cb26..da7801e350a 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -154,4 +154,8 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() +if(WITH_XDG_USER_DIRS) + add_definitions(-DWITH_XDG_USER_DIRS) +endif() + blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index ab3de94d77c..e7031c943c1 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -53,7 +53,7 @@ #include "GHOST_Path-api.h" #if defined WIN32 && !defined _LIBC -# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */ +# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */ #else # ifndef _GNU_SOURCE # define _GNU_SOURCE @@ -62,35 +62,34 @@ #endif #ifdef WIN32 -#include <io.h> - -#ifdef _WIN32_IE -#undef _WIN32_IE -#endif -#define _WIN32_IE 0x0501 -#include <windows.h> -#include <shlobj.h> - -#include "BLI_winstuff.h" - +# include <io.h> +# ifdef _WIN32_IE +# undef _WIN32_IE +# endif +# define _WIN32_IE 0x0501 +# include <windows.h> +# include <shlobj.h> +# include "BLI_winstuff.h" #else /* non windows */ - -#ifdef WITH_BINRELOC -#include "binreloc.h" -#endif - +# ifdef WITH_BINRELOC +# include "binreloc.h" +# 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" +# 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 -#define BLENDER_USER_FORMAT "%s/.blender/%s" -#define BLENDER_SYSTEM_FORMAT "%s/blender/%s" +# 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 */ @@ -798,10 +797,18 @@ void BLI_getlastdir(const char* dir, char *last, const size_t maxlen) as default location to save documents */ const char *BLI_getDefaultDocumentFolder(void) { - #if !defined(WIN32) +#ifndef WIN32 + +#ifdef WITH_XDG_USER_DIRS + const char *xdg_documents_dir= getenv("XDG_DOCUMENTS_DIR"); + if (xdg_documents_dir) { + return xdg_documents_dir; + } +#endif + return getenv("HOME"); - #else /* Windows */ +#else /* Windows */ const char * ret; static char documentfolder[MAXPATHLEN]; HRESULT hResult; @@ -826,7 +833,7 @@ const char *BLI_getDefaultDocumentFolder(void) } return NULL; - #endif +#endif /* WIN32 */ } /* NEW stuff, to be cleaned up when fully migrated */ |