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:
-rw-r--r--intern/ghost/GHOST_C-api.h4
-rw-r--r--intern/ghost/GHOST_ISystem.h4
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp4
-rw-r--r--intern/ghost/intern/GHOST_System.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp17
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm4
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp4
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp14
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h4
-rw-r--r--intern/ghost/intern/GHOST_WindowCarbon.cpp4
-rw-r--r--source/blender/blenlib/CMakeLists.txt2
-rw-r--r--source/blender/blenlib/SConscript2
-rw-r--r--source/blender/blenlib/intern/BLI_bfile.c30
-rw-r--r--source/blender/blenlib/intern/Makefile2
17 files changed, 54 insertions, 57 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 75a055075bc..346fa292520 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -824,14 +824,14 @@ extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
-extern GHOST_TUns8* GHOST_getSystemDir();
+extern const GHOST_TUns8* GHOST_getSystemDir();
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
-extern GHOST_TUns8* GHOST_getUserDir();
+extern const GHOST_TUns8* GHOST_getUserDir();
#ifdef __cplusplus
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 5e0c7f41ab8..fd8641f2055 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -380,14 +380,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual GHOST_TUns8* getSystemDir() const = 0;
+ virtual const GHOST_TUns8* getSystemDir() const = 0;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- virtual GHOST_TUns8* getUserDir() const = 0;
+ virtual const GHOST_TUns8* getUserDir() const = 0;
protected:
/**
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index fd06d7620ab..51305e82064 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -855,13 +855,13 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
system->putClipboard(buffer, selection);
}
-GHOST_TUns8* GHOST_getSystemDir()
+const GHOST_TUns8* GHOST_getSystemDir()
{
GHOST_ISystem* system = GHOST_ISystem::getSystem();
return system->getSystemDir();
}
-GHOST_TUns8* GHOST_getUserDir()
+const GHOST_TUns8* GHOST_getUserDir()
{
GHOST_ISystem* system = GHOST_ISystem::getSystem();
return system->getUserDir();
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 59f933ea865..d6c6a356323 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -302,14 +302,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual GHOST_TUns8* getSystemDir() const = 0;
+ virtual const GHOST_TUns8* getSystemDir() const = 0;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- virtual GHOST_TUns8* getUserDir() const = 0;
+ virtual const GHOST_TUns8* getUserDir() const = 0;
protected:
/**
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 52b797f56b5..36ea1c7fe85 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -809,7 +809,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
}
err = noErr;
}
-
+ return err;
}
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
@@ -1215,22 +1215,19 @@ void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
-GHOST_TUns8* GHOST_SystemCarbon::getSystemDir() const
+const GHOST_TUns8* GHOST_SystemCarbon::getSystemDir() const
{
- static GHOST_TUns8 sysPath[64];
-
- strcpy((char*)sysPath,"/Library/Application Support/Blender");
-
- return sysPath;
+ return (GHOST_TUns8*)"/Library/Application Support/Blender";
}
-GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const
+const GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const
{
- static char usrPath[512] = "";
+ static char usrPath[256] = "";
char* env = getenv("HOME");
if (env) {
- strcpy(usrPath, env);
+ strncpy(usrPath, env, 245);
+ usrPath[245]=0;
strcat(usrPath, "/Library/Application Support/Blender");
return (GHOST_TUns8*) usrPath;
}
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index b27d7917377..7f0870674b4 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -195,14 +195,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual GHOST_TUns8* getSystemDir() const;
+ virtual const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- virtual GHOST_TUns8* getUserDir() const;
+ virtual const GHOST_TUns8* getUserDir() const;
protected:
/**
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 2f1a94fc8eb..b25f8890cf1 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -218,14 +218,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- virtual GHOST_TUns8* getSystemDir() const;
+ virtual const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- virtual GHOST_TUns8* getUserDir() const;
+ virtual const GHOST_TUns8* getUserDir() const;
/**
* Handles a window event. Called by GHOST_WindowCocoa window delegate
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 15ea3730c6e..5289920cccb 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1714,7 +1714,7 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
#pragma mark Base directories retrieval
-GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
+const GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -1742,7 +1742,7 @@ GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
return tempPath;
}
-GHOST_TUns8* GHOST_SystemCocoa::getUserDir() const
+const GHOST_TUns8* GHOST_SystemCocoa::getUserDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 0cbd3e99c73..b1c5ee6e6f2 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1095,12 +1095,12 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
-GHOST_TUns8* GHOST_SystemWin32::getSystemDir() const
+const GHOST_TUns8* GHOST_SystemWin32::getSystemDir() const
{
return NULL;
}
-GHOST_TUns8* GHOST_SystemWin32::getUserDir() const
+const GHOST_TUns8* GHOST_SystemWin32::getUserDir() const
{
return NULL;
}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 1b7b2aad766..75bb858fb49 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -193,14 +193,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- GHOST_TUns8* getSystemDir() const;
+ virtual const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- GHOST_TUns8* getUserDir() const;
+ virtual const GHOST_TUns8* getUserDir() const;
/**
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 5eab71eebf5..cbf775045fd 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1458,19 +1458,19 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
-GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
+const GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
{
-
+ return (GHOST_TUns8*)"/usr/share/blender";
}
-GHOST_TUns8* GHOST_SystemX11::getUserDir() const
+const GHOST_TUns8* GHOST_SystemX11::getUserDir() const
{
- char* path;
+ static char path[256];
char* env = getenv("HOME");
if(env) {
- path = (char*) malloc(strlen(env) + 10); // "/.blender/"
- strcat(path, env);
- strcat(path, "/,blender/");
+ strncpy(path, env, 245);
+ path[245]=0;
+ strcat(path, "/.blender/");
return (GHOST_TUns8*) path;
} else {
return NULL;
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index b839b5a057a..1d9959cc931 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -231,14 +231,14 @@ public:
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
- GHOST_TUns8* getSystemDir() const;
+ const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
- GHOST_TUns8* getUserDir() const;
+ const GHOST_TUns8* getUserDir() const;
/**
* Atom used for ICCCM, WM-spec and Motif.
diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp
index ab06df8a746..65584e4cc1f 100644
--- a/intern/ghost/intern/GHOST_WindowCarbon.cpp
+++ b/intern/ghost/intern/GHOST_WindowCarbon.cpp
@@ -136,14 +136,14 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
&m_windowRef);
if ( err != noErr) {
- fprintf(stderr," error creating window %i \n",err);
+ fprintf(stderr," error creating window %i \n",(int)err);
} else {
::SetWRefCon(m_windowRef,(SInt32)this);
setTitle(title);
err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL);
if ( err != noErr) {
- fprintf(stderr," error creating handler %i \n",err);
+ fprintf(stderr," error creating handler %i \n",(int)err);
} else {
// ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
::ShowWindow(m_windowRef);
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index b534087f32c..fec5f1803eb 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -28,7 +28,7 @@ FILE(GLOB SRC intern/*.c)
SET(INC
. ../makesdna ../blenkernel ../../../intern/guardedalloc ../include
- ../gpu
+ ../gpu ../../../intern/ghost
${FREETYPE_INCLUDE_DIRS}
${ZLIB_INC}
)
diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript
index df1a096cb99..090094a834d 100644
--- a/source/blender/blenlib/SConscript
+++ b/source/blender/blenlib/SConscript
@@ -4,7 +4,7 @@ Import ('env')
sources = env.Glob('intern/*.c')
cflags=''
-incs = '. ../makesdna ../blenkernel #/intern/guardedalloc ../editors/include ../gpu'
+incs = '. ../makesdna ../blenkernel #/intern/guardedalloc #/intern/ghost ../editors/include ../gpu'
incs += ' ' + env['BF_FREETYPE_INC']
incs += ' ' + env['BF_ZLIB_INC']
defs = ''
diff --git a/source/blender/blenlib/intern/BLI_bfile.c b/source/blender/blenlib/intern/BLI_bfile.c
index 9540b16d2f4..3306283ad3f 100644
--- a/source/blender/blenlib/intern/BLI_bfile.c
+++ b/source/blender/blenlib/intern/BLI_bfile.c
@@ -46,6 +46,8 @@
#include "BLI_storage.h"
#include "BLI_bfile.h"
+#include "GHOST_C-api.h"
+
/* Internal bfile classification flags */
#define BCF_OPEN (0)
#define BCF_FOPEN (1<<0)
@@ -54,6 +56,11 @@
#define BCF_AT_END (1<<3)
#define BCF_DISCARD (1<<4)
+/* Standard files names */
+#define LAST_SESSION_FILE "last-session"
+#define ENVIRONMENT_FILE "environment"
+
+
/* Declaration of internal functions */
void chomp(char* line);
void expand_envvars(char* src, char* dst);
@@ -221,19 +228,6 @@ void BLI_bfile_set_error(BFILE *bfile, int error) {
}
-#if defined(WIN32)
- #define LAST_SESSION_FILE "%HOME%\\Blender\\last-session FIXME FIXME FIXME"
- #define ENVIRONMENT_FILE "FIXME"
- #define SHARED_DIRECTORY "FIXME TOO"
-#elif defined(OSX)
- #define LAST_SESSION_FILE "${HOME}/Library/Application Support/Blender/last-session"
- #define ENVIRONMENT_FILE "${HOME}/Library/Application Support/Blender/${BLENDER_VERSION}/environment"
- #define SHARED_DIRECTORY "/Library/Application Support/Blender"
-#else
- #define LAST_SESSION_FILE "${HOME}/.blender/last-session"
- #define ENVIRONMENT_FILE "${HOME}/.blender/${BLENDER_VERSION}/environment"
- #define SHARED_DIRECTORY "/usr/share/blender"
-#endif
void BLI_bfile_init_vars() {
char file[MAXPATHLEN];
char temp[MAXPATHLEN];
@@ -249,10 +243,12 @@ void BLI_bfile_init_vars() {
if(BLI_exist(temp)) {
BLI_setenv_if_new("BLENDER_SHARE", dirname(bprogname));
} else {
- BLI_setenv_if_new("BLENDER_SHARE", SHARED_DIRECTORY);
+ BLI_setenv_if_new("BLENDER_SHARE", (const char*)GHOST_getSystemDir());
}
- expand_envvars(LAST_SESSION_FILE, file);
+ strcpy(file, (const char*)GHOST_getUserDir());
+ BLI_add_slash(file);
+ strcat(file, LAST_SESSION_FILE);
fp = fopen(file, "r");
/* 1st line, read previous version */
if (fp && (fscanf(fp, "%3c\n", temp) == 1)) {
@@ -283,7 +279,9 @@ void BLI_bfile_init_vars() {
}
/* Load vars from user and system files */
- expand_envvars(ENVIRONMENT_FILE, file);
+ strcpy(file, (const char *)GHOST_getUserDir());
+ BLI_add_slash(file);
+ strcat(file, ENVIRONMENT_FILE);
init_vars_from_file(file);
sprintf(temp, "/%d/environment", BLENDER_VERSION);
BLI_make_file_string("/", file, getenv("BLENDER_SHARE"), temp);
diff --git a/source/blender/blenlib/intern/Makefile b/source/blender/blenlib/intern/Makefile
index d8aed3ac0ed..130f025d31b 100644
--- a/source/blender/blenlib/intern/Makefile
+++ b/source/blender/blenlib/intern/Makefile
@@ -52,6 +52,8 @@ CPPFLAGS += -I$(NAN_ZLIB)/include
CPPFLAGS += -I../../gpu
+CPPFLAGS += -I../../../intern/ghost
+
ifdef NAN_PTHREADS
CPPFLAGS += -I$(NAN_PTHREADS)/include
endif