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 | |
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')
-rw-r--r-- | source/blender/blenlib/BLI_blenlib.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/SConscript | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/Makefile | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/util.c | 19 | ||||
-rw-r--r-- | source/blender/src/usiblender.c | 3 | ||||
-rw-r--r-- | source/creator/Makefile | 3 | ||||
-rw-r--r-- | source/creator/SConscript | 3 | ||||
-rw-r--r-- | source/creator/creator.c | 10 |
9 files changed, 43 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index eb13ddc318c..42b3bf2ce14 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -254,7 +254,7 @@ void BLI_free_file_lines(struct LinkNode *lines); * @param fullname The full path and full name of the executable * @param name The name of the executable (usually argv[0]) to be checked */ -void BLI_where_am_i(char *fullname, char *name); +void BLI_where_am_i(char *fullname, const char *name); /** * determines the full path to the application bundle on OS X @@ -297,7 +297,7 @@ int BLI_gzip(char *from, char *to); int BLI_delete(char *file, int dir, int recursive); int BLI_move(char *file, char *to); int BLI_touch(char *file); -char *BLI_last_slash(char *string); +char *BLI_last_slash(const char *string); /* BLI_rct.c */ /** diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript index e11934d968e..649d3cb5659 100644 --- a/source/blender/blenlib/SConscript +++ b/source/blender/blenlib/SConscript @@ -19,6 +19,7 @@ if env['WITH_BF_VERSE']: if env['OURPLATFORM'] == 'linux2': cflags='-pthread' + incs += ' ../../../extern/binreloc/include' if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/blenlib/intern/Makefile b/source/blender/blenlib/intern/Makefile index 68148a1eb37..9f40710209d 100644 --- a/source/blender/blenlib/intern/Makefile +++ b/source/blender/blenlib/intern/Makefile @@ -59,3 +59,6 @@ endif ifeq ($(WITH_FREETYPE2), true) CPPFLAGS += -DWITH_FREETYPE2 endif +ifeq ($(OS),linux) + CPPFLAGS += -I$(OCGDIR)/extern/binreloc/include +endif
\ No newline at end of file diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index fcea30982bd..fe2d07238b6 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -79,7 +79,7 @@ char *first_slash(char *string) { else return fbslash; } -char *BLI_last_slash(char *string) { +char *BLI_last_slash(const char *string) { char *lfslash, *lbslash; lfslash= strrchr(string, '/'); 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] == '.') { diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index dd6d3eb6d15..ee0dffaafa3 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -688,6 +688,9 @@ static void readBlog(void) fsmenu_append_separator(); } +#else + /* add home dir on linux systems */ + fsmenu_insert_entry(BLI_gethome(), 0, 0); #endif BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs"); diff --git a/source/creator/Makefile b/source/creator/Makefile index 02c22aa4da8..5fba2a1bb70 100644 --- a/source/creator/Makefile +++ b/source/creator/Makefile @@ -42,6 +42,9 @@ CFLAGS += $(LEVEL_1_C_WARNINGS) CPPFLAGS += -I../blender/render/extern/include CPPFLAGS += -I../blender/radiosity/extern/include +ifeq ($(OS),linux) + CPPFLAGS += -I$(OCGDIR)/extern/binreloc/include +endif # two needed for the kernel CPPFLAGS += -I../blender/imbuf CPPFLAGS += -I../blender/makesdna diff --git a/source/creator/SConscript b/source/creator/SConscript index 9bc49b2fc30..b09229a1641 100644 --- a/source/creator/SConscript +++ b/source/creator/SConscript @@ -15,4 +15,7 @@ if env['WITH_BF_QUICKTIME']==1: incs += ' ' + env['BF_QUICKTIME_INC'] defs.append('WITH_QUICKTIME') +if env['OURPLATFORM'] == 'linux2': + incs += ' ../../extern/binreloc/include' + env.BlenderLib ( libname = 'blender_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 1 ) diff --git a/source/creator/creator.c b/source/creator/creator.c index 9b5a151b56b..7e426288340 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -97,6 +97,10 @@ # include <sys/rtprio.h> #endif +#ifdef __linux__ +#include "binreloc.h" +#endif + // from buildinfo.c #ifdef BUILD_DATE extern char * build_date; @@ -253,6 +257,12 @@ int main(int argc, char **argv) int audio = 0; #endif + +#ifdef __linux__ + /* linux uses binrealoc to know its binary path */ + br_init( NULL ); +#endif + setCallbacks(); #ifdef __APPLE__ /* patch to ignore argument finder gives us (pid?) */ |