diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-01-18 18:10:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-01-18 18:10:17 +0300 |
commit | 09c2fd6f11eb00809678e869aec32f305e03ef02 (patch) | |
tree | bd8b41d8c089f1eef4d5d87b98e3b07c6c9ce275 /source/blender/blenlib/intern/util.c | |
parent | afc53a1eba9041e69e7bbb95a7a9f43aeb804931 (diff) |
Linux only addition to know for sure the path of blender because sometimes the Play button doesn't work depending on how blender is started.
This uses binreloc - http://autopackage.org/docs/binreloc/
it should also solve the problem of python scripts not being found.
Diffstat (limited to 'source/blender/blenlib/intern/util.c')
-rw-r--r-- | source/blender/blenlib/intern/util.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index d1b2efa28c7..d6f76fb9259 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -84,6 +84,10 @@ #include <CoreFoundation/CoreFoundation.h> #endif +#ifdef __linux__ +#include "binreloc.h" +#endif + /* local */ static int add_win32_extension(char *name); @@ -1444,10 +1448,10 @@ static int add_win32_extension(char *name) return (retval); } -void BLI_where_am_i(char *fullname, char *name) +void BLI_where_am_i(char *fullname, const char *name) { char filename[FILE_MAXDIR+FILE_MAXFILE]; - char *path, *temp; + char *path = NULL, *temp; int len; #ifdef _WIN32 char *seperator = ";"; @@ -1457,6 +1461,17 @@ void BLI_where_am_i(char *fullname, char *name) char *slash = "/"; #endif + +#ifdef __linux__ + /* linux uses binreloc since argv[0] is not relyable, call br_init( NULL ) first */ + path = br_find_exe( NULL ); + if (path) { + strcpy(fullname, path); + return; + } +#endif + + /* unix and non linux */ if (name && fullname && strlen(name)) { strcpy(fullname, name); if (name[0] == '.') { |