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:
authorCampbell Barton <ideasman42@gmail.com>2008-01-18 18:10:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2008-01-18 18:10:17 +0300
commit09c2fd6f11eb00809678e869aec32f305e03ef02 (patch)
treebd8b41d8c089f1eef4d5d87b98e3b07c6c9ce275 /source/blender/blenlib
parentafc53a1eba9041e69e7bbb95a7a9f43aeb804931 (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')
-rw-r--r--source/blender/blenlib/BLI_blenlib.h4
-rw-r--r--source/blender/blenlib/SConscript1
-rw-r--r--source/blender/blenlib/intern/Makefile3
-rw-r--r--source/blender/blenlib/intern/fileops.c2
-rw-r--r--source/blender/blenlib/intern/util.c19
5 files changed, 24 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] == '.') {