diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-05 00:21:40 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-05 00:21:40 +0400 |
commit | 942d2fe3b7b75facbf280271b1adc31882fc5693 (patch) | |
tree | d3bdbd3fd41aea01afb5ebdbb9240c8de18f1db7 /intern | |
parent | a620ec61ec173b7d9b753c9be443fdbdb1644c71 (diff) | |
parent | 7b47a4125fa4219a0f6c1a3e8c78047211caaa53 (diff) |
Cycles: svn merge -r41467:41531 ^/trunk/blender
Diffstat (limited to 'intern')
-rw-r--r-- | intern/audaspace/Python/AUD_PyAPI.cpp | 32 | ||||
-rw-r--r-- | intern/ghost/CMakeLists.txt | 4 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemPathsX11.cpp | 25 |
3 files changed, 45 insertions, 16 deletions
diff --git a/intern/audaspace/Python/AUD_PyAPI.cpp b/intern/audaspace/Python/AUD_PyAPI.cpp index 0dfa39de66c..bbc7a0ca52e 100644 --- a/intern/audaspace/Python/AUD_PyAPI.cpp +++ b/intern/audaspace/Python/AUD_PyAPI.cpp @@ -226,7 +226,7 @@ Factory_lowpass(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f|f:lowpass", &frequency, &Q)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -267,7 +267,7 @@ Factory_delay(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f:delay", &delay)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -303,7 +303,7 @@ PyDoc_STRVAR(M_aud_Factory_join_doc, static PyObject * Factory_join(Factory* self, PyObject* object) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); if(!PyObject_TypeCheck(object, type)) { @@ -354,7 +354,7 @@ Factory_highpass(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f|f:highpass", &frequency, &Q)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -395,7 +395,7 @@ Factory_limit(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "ff:limit", &start, &end)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -439,7 +439,7 @@ Factory_pitch(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f:pitch", &factor)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -481,7 +481,7 @@ Factory_volume(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f:volume", &volume)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -524,7 +524,7 @@ Factory_fadein(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "ff:fadein", &start, &length)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -568,7 +568,7 @@ Factory_fadeout(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "ff:fadeout", &start, &length)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -610,7 +610,7 @@ Factory_loop(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "i:loop", &loop)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -646,7 +646,7 @@ PyDoc_STRVAR(M_aud_Factory_mix_doc, static PyObject * Factory_mix(Factory* self, PyObject* object) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); if(!PyObject_TypeCheck(object, type)) { @@ -686,7 +686,7 @@ PyDoc_STRVAR(M_aud_Factory_pingpong_doc, static PyObject * Factory_pingpong(Factory* self) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -725,7 +725,7 @@ PyDoc_STRVAR(M_aud_Factory_reverse_doc, static PyObject * Factory_reverse(Factory* self) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -763,7 +763,7 @@ PyDoc_STRVAR(M_aud_Factory_buffer_doc, static PyObject * Factory_buffer(Factory* self) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -802,7 +802,7 @@ Factory_square(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "|f:square", &threshold)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -905,7 +905,7 @@ Factory_filter(Factory* self, PyObject* args) else a.push_back(1); - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 4446426098a..a84ff5825a9 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -108,6 +108,10 @@ if(WITH_INPUT_NDOF) ) 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 diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp index 1456bdef543..726149138ed 100644 --- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp +++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp @@ -41,6 +41,11 @@ #include <stdio.h> // for fprintf only #include <cstdlib> // for exit +#ifdef WITH_XDG_USER_DIRS +# include <pwd.h> // for get home without use getenv() +# include <limits.h> // for PATH_MAX +#endif + #ifdef PREFIX static const char *static_path= PREFIX "/share" ; #else @@ -63,7 +68,27 @@ const GHOST_TUns8* GHOST_SystemPathsX11::getSystemDir() const const GHOST_TUns8* GHOST_SystemPathsX11::getUserDir() const { +#ifndef WITH_XDG_USER_DIRS return (const GHOST_TUns8 *)getenv("HOME"); +#else /* WITH_XDG_USER_DIRS */ + const char *home= getenv("XDG_CONFIG_HOME"); + + if (home) { + return (const GHOST_TUns8 *)home; + } + else { + static char user_path[PATH_MAX]; + + home= getenv("HOME"); + + if (home == NULL) { + home= getpwuid(getuid())->pw_dir; + } + + snprintf(user_path, sizeof(user_path), "%s/.config", home); + return (const GHOST_TUns8 *)user_path; + } +#endif /* WITH_XDG_USER_DIRS */ } const GHOST_TUns8* GHOST_SystemPathsX11::getBinaryDir() const |