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--SConstruct23
-rw-r--r--intern/ghost/GHOST_C-api.h14
-rw-r--r--intern/ghost/GHOST_ISystem.h18
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp12
-rw-r--r--intern/ghost/intern/GHOST_System.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp20
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm58
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp10
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp19
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h14
-rw-r--r--release/scripts/ui/space_info.py22
-rw-r--r--source/blender/blenfont/intern/blf_lang.c58
-rw-r--r--source/blender/blenkernel/SConscript1
-rw-r--r--source/blender/blenkernel/intern/blender.c3
-rw-r--r--source/blender/blenlib/BLI_path_util.h61
-rw-r--r--source/blender/blenlib/CMakeLists.txt4
-rw-r--r--source/blender/blenlib/intern/BLI_bfile.c223
-rw-r--r--source/blender/blenlib/intern/path_util.c334
-rw-r--r--source/blender/blenlib/intern/path_util_cocoa.mm96
-rw-r--r--source/blender/blenloader/intern/writefile.c2
-rw-r--r--source/blender/editors/interface/interface_icons.c41
-rw-r--r--source/blender/editors/space_file/file_ops.c6
-rw-r--r--source/blender/editors/space_file/fsmenu.c56
-rw-r--r--source/blender/editors/space_file/fsmenu.h5
-rw-r--r--source/blender/editors/space_file/space_file.c13
-rw-r--r--source/blender/editors/space_image/SConscript1
-rw-r--r--source/blender/editors/space_info/space_info.c31
-rw-r--r--source/blender/makesrna/SConscript3
-rw-r--r--source/blender/python/intern/bpy.c2
-rw-r--r--source/blender/python/intern/bpy_interface.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files.c35
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/wm_files.h2
-rw-r--r--source/creator/CMakeLists.txt19
-rw-r--r--tools/Blender.py2
-rw-r--r--tools/btools.py13
39 files changed, 631 insertions, 650 deletions
diff --git a/SConstruct b/SConstruct
index 531d89b6447..0b985f3321a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -437,6 +437,8 @@ else:
#-- .blender
#- dont do .blender and scripts for darwin, it is already in the bundle
dotblendlist = []
+datafileslist = []
+datafilestargetlist = []
dottargetlist = []
scriptinstall = []
@@ -455,17 +457,26 @@ if env['OURPLATFORM']!='darwin':
if f.endswith('.ttf'):
continue
- dotblendlist.append(os.path.join(dp, f))
- if env['WITH_BF_FHS']: dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[2:])) # skip bin/.blender
- else: dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[1:])) # skip bin
-
- dottargetlist.append(dir + os.sep + f)
-
+ if 'locale' in dp:
+ datafileslist.append(os.path.join(dp,f))
+ if env['WITH_BF_FHS']: dir= os.path.join(*([BLENDERPATH] + ['datafiles'] + dp.split(os.sep)[2:])) # skip bin/.blender
+ else: dir= os.path.join(*([BLENDERPATH] + ['.blender'] + ['datafiles'] + dp.split(os.sep)[1:])) # skip bin
+ datafilestargetlist.append(dir + os.sep + f)
+ else:
+ dotblendlist.append(os.path.join(dp, f))
+ if env['WITH_BF_FHS']: dir= os.path.join(*([BLENDERPATH] + ['config'] + dp.split(os.sep)[2:])) # skip bin/.blender
+ else: dir= os.path.join(*([BLENDERPATH] + ['.blender'] + ['config'] + dp.split(os.sep)[1:])) # skip bin
+
+ dottargetlist.append(dir + os.sep + f)
+
dotblenderinstall = []
for targetdir,srcfile in zip(dottargetlist, dotblendlist):
td, tf = os.path.split(targetdir)
dotblenderinstall.append(env.Install(dir=td, source=srcfile))
+ for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
+ td, tf = os.path.split(targetdir)
+ dotblenderinstall.append(env.Install(dir=td, source=srcfile))
if env['WITH_BF_PYTHON']:
#-- .blender/scripts
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index a5fec1f101c..28fa72f9700 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -836,20 +836,6 @@ extern GHOST_TUns8* GHOST_getClipboard(int selection);
*/
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
-/**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "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 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 const GHOST_TUns8* GHOST_getUserDir();
-
#ifdef __cplusplus
}
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 8d80c74e140..b4dc88369f4 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -371,24 +371,6 @@ public:
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
- /***************************************************************************************
- ** Determine special paths.
- ***************************************************************************************/
-
- /**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "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 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 const GHOST_TUns8* getUserDir() const = 0;
-
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 9da20200f63..839d85c9617 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -865,15 +865,3 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
GHOST_ISystem* system = GHOST_ISystem::getSystem();
system->putClipboard(buffer, selection);
}
-
-const GHOST_TUns8* GHOST_getSystemDir()
-{
- GHOST_ISystem* system = GHOST_ISystem::getSystem();
- return system->getSystemDir();
-}
-
-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 d6c6a356323..2b45bfb86cf 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -297,20 +297,6 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
- /**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "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 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 const GHOST_TUns8* getUserDir() const = 0;
-
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 5522a0736c4..a4011f89de6 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -1214,23 +1214,3 @@ void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
CFRelease(textData);
}
}
-
-const GHOST_TUns8* GHOST_SystemCarbon::getSystemDir() const
-{
- return (GHOST_TUns8*)"/Library/Application Support/Blender";
-}
-
-const GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const
-{
- static char usrPath[256] = "";
- char* env = getenv("HOME");
-
- if (env) {
- strncpy(usrPath, env, 245);
- usrPath[245]=0;
- strcat(usrPath, "/Library/Application Support/Blender");
- return (GHOST_TUns8*) usrPath;
- }
- else
- return NULL;
-}
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index ebd929749b6..fd5c61fd7b6 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -190,20 +190,6 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
- /**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "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 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 const GHOST_TUns8* getUserDir() const;
-
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index b97c36f04a8..e97f8c70521 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -214,20 +214,6 @@ public:
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "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 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 const GHOST_TUns8* getUserDir() const;
-
- /**
* Handles a window event. Called by GHOST_WindowCocoa window delegate
* @param eventType The type of window event
* @param window The window on which the event occured
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 2cec24714be..00b00c69cee 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1780,61 +1780,3 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
[pool drain];
}
-
-#pragma mark Base directories retrieval
-
-const GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
-{
- static GHOST_TUns8 tempPath[512] = "";
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSFileManager *fileManager;
- NSString *basePath;
- NSArray *paths;
-
- paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES);
-
- if ([paths count] > 0)
- basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
- else { //Fall back to standard unix path in case of issue
- basePath = @"/usr/share/blender";
- }
-
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
- }
-
- strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
-
- [pool drain];
- return tempPath;
-}
-
-const GHOST_TUns8* GHOST_SystemCocoa::getUserDir() const
-{
- static GHOST_TUns8 tempPath[512] = "";
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSFileManager *fileManager;
- NSString *basePath;
- NSArray *paths;
-
- paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
-
- if ([paths count] > 0)
- basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
- else { //Fall back to HOME in case of issue
- basePath = [NSHomeDirectory() stringByAppendingPathComponent:@".blender"];
- }
-
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
- }
-
- strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
-
- [pool drain];
- return tempPath;
-}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 91c1927f8e7..41cbb72c9b9 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1092,13 +1092,3 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
return;
}
}
-
-const GHOST_TUns8* GHOST_SystemWin32::getSystemDir() const
-{
- return NULL;
-}
-
-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 e65393a4faa..84fca33238f 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -189,20 +189,6 @@ public:
/**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "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 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 const GHOST_TUns8* getUserDir() const;
-
- /**
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
* Called by GHOST_DropTargetWin32 class.
* @param eventType The type of drag'n'drop event
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 052c868e5e0..f286f8ae7d3 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1458,22 +1458,3 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
fprintf(stderr, "failed to own primary\n");
}
}
-
-const GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
-{
- return (GHOST_TUns8*)"/usr/share/blender";
-}
-
-const GHOST_TUns8* GHOST_SystemX11::getUserDir() const
-{
- static char path[256];
- char* env = getenv("HOME");
- if(env) {
- 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 ee6cbedb2ae..6a4ff1b41c7 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -227,20 +227,6 @@ public:
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "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/).
- */
- 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/).
- */
- const GHOST_TUns8* getUserDir() const;
-
- /**
* Atom used for ICCCM, WM-spec and Motif.
* We only need get this atom at the start, it's relative
* to the display not the window and are public for every
diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py
index 5ed6043cbe7..db8750a28fb 100644
--- a/release/scripts/ui/space_info.py
+++ b/release/scripts/ui/space_info.py
@@ -124,27 +124,6 @@ class INFO_MT_file(bpy.types.Menu):
layout.operator("wm.exit_blender", text="Quit", icon='QUIT')
-class INFO_MT_file_open_recent(bpy.types.Menu):
- bl_idname = "INFO_MT_file_open_recent"
- bl_label = "Open Recent..."
-
- def draw(self, context):
- import os
- layout = self.layout
- layout.operator_context = 'EXEC_AREA'
-
- filepath = os.path.join(bpy.app.home, ".Blog")
-
- if os.path.isfile(filepath):
- file = open(filepath, "rU")
- for line in file:
- line = line.rstrip()
- layout.operator("wm.open_mainfile", text=line, icon='FILE_BLEND').filepath = line
- file.close()
- else:
- layout.label(text='No recent files')
-
-
class INFO_MT_file_import(bpy.types.Menu):
bl_idname = "INFO_MT_file_import"
bl_label = "Import"
@@ -374,7 +353,6 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
classes = [
INFO_HT_header,
INFO_MT_file,
- INFO_MT_file_open_recent,
INFO_MT_file_import,
INFO_MT_file_export,
INFO_MT_file_external_data,
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index bc2de70222d..1baf2c82ef7 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -59,65 +59,19 @@ char global_messagepath[1024];
char global_language[32];
char global_encoding_name[32];
-#if defined(__APPLE__)
-void BLF_lang_init(void) /* Apple Only, todo - use BLI_gethome_folder */
-{
- char *bundlepath;
-
- strcpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT);
-
- /* set messagepath directory */
-#ifndef LOCALEDIR
-#define LOCALEDIR "/usr/share/locale"
-#endif
-
- strcpy(global_messagepath, ".blender/locale");
-
- if (!BLI_exist(global_messagepath)) { /* locale not in current dir */
- BLI_make_file_string("/", global_messagepath, BLI_gethome(), ".blender/locale");
- if (!BLI_exist(global_messagepath)) { /* locale not in home dir */
- /* message catalogs are stored inside the application bundle */
- bundlepath= BLI_getbundle();
- strcpy(global_messagepath, bundlepath);
- strcat(global_messagepath, "/Contents/Resources/locale");
- if (!BLI_exist(global_messagepath)) { /* locale not in bundle (now that's odd..) */
- strcpy(global_messagepath, LOCALEDIR);
-
- if (!BLI_exist(global_messagepath)) { /* locale not in LOCALEDIR */
- strcpy(global_messagepath, "message"); /* old compatibility as last */
- }
- }
- }
- }
-}
-#elif defined(_WIN32)
-void BLF_lang_init(void) /* Windows Only, todo - use BLI_gethome_folder */
+void BLF_lang_init(void)
{
- strcpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT);
+ char *messagepath= BLI_get_folder(BLENDER_DATAFILES, "locale");
- strcpy(global_messagepath, ".blender/locale");
-
- if (!BLI_exist(global_messagepath)) { /* locale not in current dir */
- BLI_make_file_string("/", global_messagepath, BLI_gethome(), ".blender/locale");
-
- if (!BLI_exist(global_messagepath)) { /* locale not in home dir */
- BLI_make_file_string("/", global_messagepath, BLI_gethome(), "/locale");
- }
- }
-}
-#else
-void BLF_lang_init(void) /* not win or mac */
-{
- char *messagepath= BLI_gethome_folder("locale", BLI_GETHOME_ALL);
+ BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name));
- if(messagepath)
- strncpy(global_messagepath, messagepath, sizeof(global_messagepath));
+ if (messagepath)
+ BLI_strncpy(global_messagepath, messagepath, sizeof(global_messagepath));
else
global_messagepath[0]= '\0';
-
}
-#endif
+
void BLF_lang_set(const char *str)
{
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 6198520c853..a6705653769 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -67,6 +67,7 @@ if env['BF_NO_ELBEEM']:
if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
+ incs += ' ' + env['BF_LCMS_INC']
if env['WITH_BF_LZO']:
incs += ' #/extern/lzo/minilzo'
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 9a97d975ede..57e72fc5671 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -55,6 +55,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BLI_path_util.h"
#include "IMB_imbuf.h"
@@ -368,7 +369,7 @@ int BKE_read_file(bContext *C, char *dir, void *unused, ReportList *reports)
BlendFileData *bfd;
int retval= 1;
- if(strstr(dir, ".B25.blend")==0) /* dont print user-pref loading */
+ if(strstr(dir, BLENDER_STARTUP_FILE)==0) /* dont print user-pref loading */
printf("read blend: %s\n", dir);
bfd= BLO_read_from_file(dir, reports);
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index fb30e991200..24b74b40a37 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -45,6 +45,58 @@ char *BLI_gethome_folder(char *folder_name, int flag);
#define BLI_GETHOME_USER 1<<3 /* home folder ~/.blender */
#define BLI_GETHOME_ALL (BLI_GETHOME_SYSTEM|BLI_GETHOME_LOCAL|BLI_GETHOME_USER)
+
+#ifdef __APPLE__
+typedef enum {
+ BasePath_Temporary = 1,
+ BasePath_BlenderShared,
+ BasePath_BlenderUser,
+ BasePath_ApplicationBundle
+} basePathesTypes;
+
+/**
+ * Gets the base path. The path may not exist.
+ * Note that return string must be copied as its persistence is not guaranteed
+ *
+ * @return base path of pathType
+ */
+const char* BLI_osx_getBasePath(basePathesTypes pathType);
+#endif
+
+char *BLI_get_folder(int folder_id, char *subfolder);
+char *BLI_get_folder_create(int folder_id, char *subfolder);
+
+/* folder_id */
+
+/* general, will find baserd on user/local/system priority */
+#define BLENDER_CONFIG 1
+#define BLENDER_DATAFILES 2
+#define BLENDER_SCRIPTS 3
+#define BLENDER_PLUGINS 4
+#define BLENDER_PYTHON 5
+
+/* user-specific */
+#define BLENDER_USER_CONFIG 31
+#define BLENDER_USER_DATAFILES 32
+#define BLENDER_USER_SCRIPTS 33
+#define BLENDER_USER_PLUGINS 34
+
+/* system */
+#define BLENDER_SYSTEM_CONFIG 51 /* optional */
+#define BLENDER_SYSTEM_DATAFILES 52
+#define BLENDER_SYSTEM_SCRIPTS 53
+#define BLENDER_SYSTEM_PLUGINS 54
+#define BLENDER_SYSTEM_PYTHON 54
+
+#define BLENDER_TEMP 80
+
+#define BLENDER_USERFOLDER(id) (id >= BLENDER_USER_CONFIG && id <= BLENDER_USER_PLUGINS)
+
+#define BLENDER_STARTUP_FILE "startup.blend"
+#define BLENDER_BOOKMARK_FILE "bookmarks.txt"
+#define BLENDER_HISTORY_FILE "recent-files.txt"
+
+
void BLI_setenv(const char *env, const char *val);
void BLI_setenv_if_new(const char *env, const char* val);
@@ -135,15 +187,6 @@ char *get_install_dir(void);
void BLI_where_is_temp(char *fullname, int usertemp);
- /**
- * determines the full path to the application bundle on OS X
- *
- * @return path to application bundle
- */
-#ifdef __APPLE__
-char* BLI_getbundle(void);
-#endif
-
#ifdef WITH_ICONV
void BLI_string_to_utf8(char *original, char *utf_8, const char *code);
#endif
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 628c2dc43a5..185e1c9c960 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -33,6 +33,10 @@ SET(INC
${ZLIB_INC}
)
+IF(APPLE)
+ SET(SRC ${SRC} intern/path_util_cocoa.m)
+ENDIF(APPLE)
+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(INC
${INC}
diff --git a/source/blender/blenlib/intern/BLI_bfile.c b/source/blender/blenlib/intern/BLI_bfile.c
index 2330beb618d..b9ac6875b20 100644
--- a/source/blender/blenlib/intern/BLI_bfile.c
+++ b/source/blender/blenlib/intern/BLI_bfile.c
@@ -48,8 +48,6 @@
#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)
@@ -64,12 +62,8 @@
/* Declaration of internal functions */
-static void chomp(char* line);
-static void expand_envvars(char* src, char* dst);
static void fill_paths(BFILE *bfile, const char *path, const char *relpath);
-static void init_vars_from_file(const char* path);
static void free_paths(BFILE* bfile);
-static void setup_temp();
/*** Exported functions ***/
@@ -274,205 +268,9 @@ void BLI_bfile_set_error(BFILE *bfile, int error) {
}
-void BLI_bfile_init_vars() {
- char file[MAXPATHLEN];
- char temp[MAXPATHLEN];
- extern char bprogname[];
- FILE* fp;
-
- /* This one is unconditional */
- sprintf(temp, "%d", BLENDER_VERSION);
- BLI_setenv("BLENDER_VERSION", temp);
-
- /* Is this unpack&run? */
- sprintf(temp, "%s/%d/environment", dirname(bprogname), BLENDER_VERSION);
- if (BLI_exist(temp)) {
- BLI_setenv_if_new("BLENDER_SHARE", dirname(bprogname));
- } else {
- BLI_setenv_if_new("BLENDER_SHARE", (const char*)GHOST_getSystemDir());
- }
-
- 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)) {
- temp[3] = '\0';
- BLI_setenv("BLENDER_VERSION_PREV", temp);
- /* 2nd line, read previous session path if needed */
- if (!getenv("BLENDER_TEMP")) {
- if ((fgets(temp, MAXPATHLEN, fp) != NULL)) {
- /* Clean any \n */
- chomp(temp);
- /* Check the dir is still there or generate new one */
- if (!BLI_exist(temp)) {
- setup_temp();
- }
- } else {
- /* We have to generate it for sure */
- setup_temp();
- }
- }
- } else {
- /* Probably new user, or only <=249 before */
- BLI_setenv("BLENDER_VERSION_PREV", "0");
- setup_temp();
- }
-
- if (fp) {
- fclose(fp);
- }
-
- /* Loaded session info (or created), so time to store current data */
- // TODO use own fuctions to get safe saving
- fp = fopen(file, "w");
- if (fp) {
- fprintf(fp, "%s\n%s\n", getenv("BLENDER_VERSION"), getenv("BLENDER_TEMP"));
- fclose(fp);
- }
-
- /* Load vars from user and system files */
- 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);
- init_vars_from_file(file);
-}
-
-
/*** Internal functions ***/
/**
- Eliminate trailing EOL by writing a \0 over it.
- Name taken from Perl.
- */
-static void chomp(char* line) {
- int len = strlen(line);
-#ifndef WIN32
- if (line[len - 1] == '\n') {
- line[len - 1] = '\0';
- }
-#else
- if ((line[len - 2] == '\r' ) && ((line[len - 1] == '\n'))) {
- line[len - 2] = '\0';
- }
-#endif /* WIN32 */
-}
-
-
-/**
- Parse a file with lines like FOO=bar (comment lines have # as first
- character) assigning to envvar FOO the value bar if FOO does not
- exist yet.
- Any white space before FOO, around the = or trailing will be used,
- so beware.
- */
-#define MAX_LINE 4096
-#define ENV_VAR 256
-#define VAR_LEN 8192
-static void init_vars_from_file(const char* path) {
- char line[MAX_LINE];
- char name[ENV_VAR];
- FILE *fp;
- char* separator;
- char expanded[VAR_LEN];
-
- fp = fopen(path, "r");
- if (!fp) return;
-
- while (fgets(line, MAX_LINE, fp) != NULL) {
- /* Ignore comment lines */
- if (line[0] == '#')
- continue;
-
- /* Split into envvar name and contents */
- separator = strchr(line, '=');
- if (separator && ((separator - line) < ENV_VAR)) {
- /* First remove EOL */
- chomp(line);
- strncpy(name, line, separator - line);
- name[separator - line] = '\0';
- expand_envvars(separator + 1, expanded);
- BLI_setenv_if_new(name, expanded);
- }
- }
- fclose(fp);
-}
-
-
-/**
- Look for ${} (or %%) env vars in src and expand if the var
- exists (even if empty value). If not exist, the name is left as is.
- The process is done all over src, and nested ${${}} is not supported.
- src must be \0 terminated, and dst must be big enough.
-*/
-#ifndef WIN32
- #define ENVVAR_PREFFIX "${"
- #define ENVVAR_P_SIZE 2
- #define ENVVAR_SUFFIX "}"
- #define ENVVAR_S_SIZE 1
-#else
- #define ENVVAR_PREFFIX "%"
- #define ENVVAR_P_SIZE 1
- #define ENVVAR_SUFFIX "%"
- #define ENVVAR_S_SIZE 1
-#endif /* WIN32 */
-static void expand_envvars(char* src, char* dst) {
- char* hit1;
- char* hit2;
- char name[ENV_VAR];
- char* value;
- int prevlen;
- int done = 0;
- char* source = src;
-
- dst[0] = '\0';
- while (!done) {
- hit1 = strstr(source, ENVVAR_PREFFIX);
- if (hit1) {
- hit2 = strstr(hit1 + ENVVAR_P_SIZE, ENVVAR_SUFFIX);
- if (hit2) {
- /* "Copy" the leading part, if any */
- if (hit1 != source) {
- prevlen = strlen(dst);
- strncat(dst, source, hit1 - source);
- dst[prevlen + (hit1 - source)] = '\0';
- }
- /* Figure the name of the env var we just found */
- strncpy(name, hit1 + ENVVAR_P_SIZE,
- hit2 - (hit1 + ENVVAR_P_SIZE));
- name[hit2 - (hit1 + ENVVAR_P_SIZE)] = '\0';
- /* See if we can get something with that name */
- value = getenv(name);
- if (value) {
- /* Push the var value */
- strcat(dst, value);
- } else {
- /* Leave the var name, so it is clear that it failed */
- strcat(dst, ENVVAR_PREFFIX);
- strcat(dst, name);
- strcat(dst, ENVVAR_SUFFIX);
- }
- /* Continue after closing mark, like a new string */
- source = hit2 + ENVVAR_S_SIZE;
- } else {
- /* Non terminated var so "copy as is" and finish */
- strcat(dst, source);
- done = 1;
- }
- } else {
- /* "Copy" whatever is left */
- strcat(dst, source);
- done = 1;
- }
- }
-}
-
-
-/**
Return a full path if the filename exists when combined
with any item from pathlist. Or NULL otherwise.
*/
@@ -572,24 +370,3 @@ static void free_paths(BFILE* bfile) {
MEM_freeN(bfile->tpath);
}
}
-
-
-/**
- Create a temp directory in safe and multiuser way.
- */
-static void setup_temp() {
- char template[MAXPATHLEN];
- char* tempdir;
-
- if (getenv("TMPDIR")) {
- sprintf(template, "%s/blender-XXXXXX", getenv("TMPDIR"));
- } else {
- sprintf(template, "/tmp/blender-XXXXXX");
-// MacOSX NSTemporaryDirectory and WIN32 ???
-// https://bugs.launchpad.net/cuneiform-linux/+bug/267136
-// https://svn.r-project.org/R/trunk/src/main/mkdtemp.c
- }
- tempdir = mkdtemp(template);
- BLI_setenv("BLENDER_TEMP", tempdir);
-}
-
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 2d5234aee34..b43da1cf9bd 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -44,6 +44,7 @@
#include "BLI_storage_types.h"
#include "BKE_utildefines.h"
+#include "BKE_blender.h" // BLENDER_VERSION
@@ -63,11 +64,6 @@
#else /* non windows */
-#ifdef __APPLE__
-#include <sys/param.h>
-#include <CoreFoundation/CoreFoundation.h>
-#endif
-
#ifdef __linux__
#include "binreloc.h"
#endif
@@ -759,7 +755,11 @@ char *BLI_gethome(void) {
}
- /* add user profile support for WIN 2K / NT */
+ /* add user profile support for WIN 2K / NT.
+ * This is %APPDATA%, which translates to either
+ * %USERPROFILE%\Application Data or since Vista
+ * to %USERPROFILE%\AppData\Roaming
+ */
hResult = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatapath);
if (hResult == S_OK)
@@ -794,7 +794,7 @@ char *BLI_gethome(void) {
/* this function returns the path to a blender folder, if it exists
* utility functions for BLI_gethome_folder */
-/* #define PATH_DEBUG */ /* for testing paths that are checked */
+// #define PATH_DEBUG /* for testing paths that are checked */
static int test_data_path(char *targetpath, char *path_base, char *path_sep, char *folder_name)
{
@@ -905,6 +905,303 @@ char *BLI_gethome_folder(char *folder_name, int flag)
return NULL;
}
+
+/* NEW stuff, to be cleaned up when fully migrated */
+/* ************************************************************* */
+/* ************************************************************* */
+
+#define PATH_DEBUG2
+
+static char *blender_version_decimal(void)
+{
+ static char version_str[5];
+ sprintf(version_str, "%d.%02d", BLENDER_VERSION/100, BLENDER_VERSION%100);
+ return version_str;
+}
+
+static int test_path(char *targetpath, char *path_base, char *path_sep, char *folder_name)
+{
+ char tmppath[FILE_MAX];
+
+ if(path_sep) BLI_join_dirfile(tmppath, path_base, path_sep);
+ else BLI_strncpy(tmppath, path_base, sizeof(tmppath));
+
+ BLI_make_file_string("/", targetpath, tmppath, folder_name);
+
+ if (BLI_exists(targetpath)) {
+#ifdef PATH_DEBUG2
+ printf("\tpath found: %s\n", targetpath);
+#endif
+ return 1;
+ }
+ else {
+#ifdef PATH_DEBUG2
+ printf("\tpath missing: %s\n", targetpath);
+#endif
+ //targetpath[0] = '\0';
+ return 0;
+ }
+}
+
+static int test_env_path(char *path, char *envvar)
+{
+ char *env = envvar?getenv(envvar):NULL;
+ if (!env) return 0;
+
+ if (BLI_exists(env)) {
+ BLI_strncpy(path, env, FILE_MAX);
+ return 1;
+ } else {
+ path[0] = '\0';
+ return 0;
+ }
+}
+
+static int get_path_local(char *targetpath, char *folder_name)
+{
+ extern char bprogname[]; /* argv[0] from creator.c */
+ char bprogdir[FILE_MAX];
+ char cwd[FILE_MAX];
+ char *s;
+ int i;
+
+#ifdef PATH_DEBUG2
+ printf("get_path_local...\n");
+#endif
+
+
+ /* use argv[0] (bprogname) to get the path to the executable */
+ s = BLI_last_slash(bprogname);
+ i = s - bprogname + 1;
+ BLI_strncpy(bprogdir, bprogname, i);
+
+ /* try EXECUTABLE_DIR/folder_name */
+ if(test_path(targetpath, bprogdir, "", folder_name))
+ return 1;
+
+ /* try CWD/release/folder_name */
+ if(test_path(targetpath, BLI_getwdN(cwd), "release", folder_name))
+ return 1;
+
+ /* try EXECUTABLE_DIR/release/folder_name */
+ if(test_path(targetpath, bprogdir, "release", folder_name))
+ return 1;
+
+ /* try EXECUTABLE_DIR/2.5/folder_name - new default directory for local blender installed files */
+ if(test_path(targetpath, bprogdir, blender_version_decimal(), folder_name))
+ return 1;
+
+ /* try ./.blender/folder_name -- DEPRECATED, need to update build systems */
+ if(test_path(targetpath, bprogdir, ".blender", folder_name))
+ return 1;
+
+ return 0;
+}
+
+#ifdef WIN32
+static int get_knownfolder_path(char *path, int folder)
+{
+ static char knownpath[MAXPATHLEN];
+ HRESULT hResult = SHGetFolderPath(NULL, folder, NULL, SHGFP_TYPE_CURRENT, knownpath);
+
+ if (hResult == S_OK)
+ {
+ if (BLI_exists(knownpath)) { /* from fop, also below... */
+ BLI_strncpy(path, knownpath, FILE_MAX);
+ return 1;
+ }
+ }
+ return 0;
+}
+#endif
+
+static int get_path_user(char *targetpath, char *folder_name, char *envvar)
+{
+ char user_path[FILE_MAX];
+#if defined(WIN32)
+ char appdata[FILE_MAX];
+#endif
+
+ user_path[0] = '\0';
+
+ if (test_env_path(targetpath, envvar))
+ return 1;
+
+#if defined(__APPLE__)
+ BLI_snprintf(user_path, FILE_MAX, "%s/%s", BLI_osx_getBasePath(BasePath_BlenderUser), blender_version_decimal());
+#elif defined(WIN32)
+ if (get_knownfolder_path(appdata, CSIDL_APPDATA)) {
+ BLI_snprintf(user_path, FILE_MAX, "%s\\Blender Foundation\\Blender\\%s", appdata, blender_version_decimal());
+ }
+#else /* UNIX */
+ /* XXX example below - replace with OS API */
+ BLI_snprintf(user_path, FILE_MAX, "%s/.blender/%s", BLI_gethome(), blender_version_decimal());
+#endif
+
+ if(!user_path[0])
+ return 0;
+
+#ifdef PATH_DEBUG2
+ printf("get_path_user: %s\n", user_path);
+#endif
+
+ /* try $HOME/folder_name */
+ return test_path(targetpath, user_path, NULL, folder_name);
+}
+
+static int get_path_system(char *targetpath, char *folder_name, char *envvar)
+{
+ char system_path[FILE_MAX];
+#if defined(WIN32)
+ char appdata[FILE_MAX];
+#endif
+
+ if (test_env_path(targetpath, envvar))
+ return 1;
+
+#if defined(__APPLE__)
+ BLI_snprintf(system_path, FILE_MAX, "%s/%s", BLI_osx_getBasePath(BasePath_ApplicationBundle), blender_version_decimal());
+#elif defined(WIN32)
+ if (get_knownfolder_path(appdata, CSIDL_COMMON_APPDATA)) {
+ BLI_snprintf(system_path, FILE_MAX, "%s\\Blender Foundation\\Blender\\%s", appdata, blender_version_decimal());
+ }
+#else /* UNIX */
+ /* XXX example below - replace with OS API */
+ BLI_snprintf(system_path, FILE_MAX, "/usr/share/blender/%s", blender_version_decimal());
+#endif
+
+ if(!system_path[0])
+ return 0;
+
+#ifdef PATH_DEBUG2
+ printf("get_path_system: %s\n", system_path);
+#endif
+
+ /* try $BLENDERPATH/folder_name */
+ return test_path(targetpath, system_path, NULL, folder_name);
+}
+
+/* get a folder out of the 'folder_id' presets for paths */
+/* returns the path if found, NULL string if not */
+char *BLI_get_folder(int folder_id, char *subfolder)
+{
+ static char path[FILE_MAX] = "";
+ char search_path[FILE_MAX];
+
+ switch (folder_id) {
+ case BLENDER_DATAFILES: /* general case */
+ BLI_join_dirfile(search_path, "datafiles", subfolder);
+ if (get_path_user(path, search_path, "BLENDER_USER_DATAFILES")) break;
+ if (get_path_local(path, search_path)) break;
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_DATAFILES")) break;
+ return NULL;
+
+ case BLENDER_USER_DATAFILES:
+ BLI_join_dirfile(search_path, "datafiles", subfolder);
+ if (get_path_user(path, search_path, "BLENDER_USER_DATAFILES")) break;
+ return NULL;
+
+ case BLENDER_SYSTEM_DATAFILES:
+ BLI_join_dirfile(search_path, "datafiles", subfolder);
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_DATAFILES")) break;
+ return NULL;
+
+ case BLENDER_CONFIG: /* general case */
+ BLI_join_dirfile(search_path, "config", subfolder);
+ if (get_path_user(path, search_path, "BLENDER_USER_CONFIG")) break;
+ if (get_path_local(path, search_path)) break;
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_CONFIG")) break;
+ return NULL;
+
+ case BLENDER_USER_CONFIG:
+ BLI_join_dirfile(search_path, "config", subfolder);
+ if (get_path_user(path, search_path, "BLENDER_USER_CONFIG")) break;
+ return NULL;
+
+ case BLENDER_SYSTEM_CONFIG:
+ BLI_join_dirfile(search_path, "config", subfolder);
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_CONFIG")) break;
+ return NULL;
+
+ case BLENDER_SCRIPTS: /* general case */
+ BLI_join_dirfile(search_path, "scripts", subfolder);
+ if (get_path_user(path, search_path, "BLENDER_USER_SCRIPTS")) break;
+ if (get_path_local(path, search_path)) break;
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_SCRIPTS")) break;
+ return NULL;
+
+ case BLENDER_USER_SCRIPTS:
+ BLI_join_dirfile(search_path, "scripts", subfolder);
+ if (get_path_user(path, search_path, "BLENDER_USER_SCRIPTS")) break;
+ return NULL;
+
+ case BLENDER_SYSTEM_SCRIPTS:
+ BLI_join_dirfile(search_path, "scripts", subfolder);
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_SCRIPTS")) break;
+ return NULL;
+
+ case BLENDER_PYTHON: /* general case */
+ BLI_join_dirfile(search_path, "python", subfolder);
+ if (get_path_local(path, search_path)) break;
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_PYTHON")) break;
+ return NULL;
+
+ case BLENDER_SYSTEM_PYTHON:
+ BLI_join_dirfile(search_path, "scripts", subfolder);
+
+ if (get_path_system(path, search_path, "BLENDER_SYSTEM_PYTHON")) break;
+ return NULL;
+ }
+
+ return path;
+}
+
+static char *BLI_get_user_folder_notest(int folder_id, char *subfolder)
+{
+ static char path[FILE_MAX] = "";
+ char search_path[FILE_MAX];
+
+ switch (folder_id) {
+ case BLENDER_USER_DATAFILES:
+ BLI_join_dirfile(search_path, "datafiles", subfolder);
+ get_path_user(path, search_path, "BLENDER_USER_DATAFILES");
+ break;
+ case BLENDER_USER_CONFIG:
+ BLI_join_dirfile(search_path, "config", subfolder);
+ get_path_user(path, search_path, "BLENDER_USER_CONFIG");
+ break;
+ }
+ if ('\0' == path[0]) {
+ return NULL;
+ }
+ return path;
+}
+
+char *BLI_get_folder_create(int folder_id, char *subfolder)
+{
+ char *path;
+
+ /* only for user folders */
+ if (!ELEM(folder_id, BLENDER_USER_DATAFILES, BLENDER_USER_CONFIG))
+ return NULL;
+
+ path = BLI_get_folder(folder_id, subfolder);
+
+ if (!path) {
+ path = BLI_get_user_folder_notest(folder_id, subfolder);
+ if (path) BLI_recurdir_fileops(path);
+ }
+
+ return path;
+}
+
+
+/* End new stuff */
+/* ************************************************************* */
+/* ************************************************************* */
+
+
+
#ifdef PATH_DEBUG
#undef PATH_DEBUG
#endif
@@ -1158,6 +1455,9 @@ void BLI_join_dirfile(char *string, const char *dir, const char *file)
if(string != dir) /* compare pointers */
BLI_strncpy(string, dir, FILE_MAX);
+
+ if (!file)
+ return;
sl_dir= BLI_add_slash(string);
@@ -1465,26 +1765,6 @@ char *get_install_dir(void) {
}
}
-/*
- * returns absolute path to the app bundle
- * only useful on OS X
- */
-#ifdef __APPLE__
-char* BLI_getbundle(void) {
- CFURLRef bundleURL;
- CFStringRef pathStr;
- static char path[MAXPATHLEN];
- CFBundleRef mainBundle = CFBundleGetMainBundle();
-
- bundleURL = CFBundleCopyBundleURL(mainBundle);
- pathStr = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
- CFStringGetCString(pathStr, path, MAXPATHLEN, kCFStringEncodingASCII);
- CFRelease(pathStr);
- CFRelease(bundleURL);
- return path;
-}
-#endif
-
#ifdef WITH_ICONV
void BLI_string_to_utf8(char *original, char *utf_8, const char *code)
diff --git a/source/blender/blenlib/intern/path_util_cocoa.mm b/source/blender/blenlib/intern/path_util_cocoa.mm
new file mode 100644
index 00000000000..00593afcd0c
--- /dev/null
+++ b/source/blender/blenlib/intern/path_util_cocoa.mm
@@ -0,0 +1,96 @@
+/* path_util_cocoa.m
+ *
+ * Functions specific to osx that use API available only in Objective-C
+ *
+ *
+ * $Id: util_cocoa.m 25007 2009-11-29 19:16:52Z kazanbas $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Damien Plisson 2010
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+
+#import <Cocoa/Cocoa.h>
+
+#include <string.h>
+
+#include "BLI_path_util.h"
+
+
+
+/**
+ * Gets the ~/Library/Application Data/Blender folder
+ */
+const char* BLI_osx_getBasePath(basePathesTypes pathType)
+{
+ static char tempPath[512] = "";
+
+ NSAutoreleasePool *pool;
+ NSString *basePath;
+ NSArray *paths;
+
+ pool = [[NSAutoreleasePool alloc] init];
+
+ switch (pathType) {
+ /* Standard pathes */
+ case BasePath_Temporary:
+ strcpy(tempPath, [NSTemporaryDirectory() cStringUsingEncoding:NSASCIIStringEncoding]);
+ [pool drain];
+ return tempPath;
+ break;
+
+ /* Blender specific pathes */
+ case BasePath_BlenderShared:
+ paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES);
+ if ([paths count] > 0)
+ basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
+ else { //Error
+ basePath = @"";
+ }
+ break;
+ case BasePath_BlenderUser:
+ paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
+ if ([paths count] > 0)
+ basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
+ else { //Error
+ basePath = @"";
+ }
+ break;
+ case BasePath_ApplicationBundle:
+ basePath = [[NSBundle mainBundle] bundlePath];
+ break;
+
+ default:
+ tempPath[0] = 0;
+ [pool drain];
+ return tempPath;
+ }
+
+ strcpy(tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
+
+ [pool drain];
+ return tempPath;
+} \ No newline at end of file
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 497c2d37c50..82d46a84bdd 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2502,7 +2502,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
makeFilesAbsolute(G.sce, NULL);
}
- BLI_make_file_string(G.sce, userfilename, BLI_gethome(), ".B25.blend");
+ BLI_make_file_string(G.sce, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
write_user_block= BLI_streq(dir, userfilename);
if(write_flags & G_FILE_RELATIVE_REMAP)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 622b9ddbfdf..499fe3b9767 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -457,25 +457,20 @@ static void init_internal_icons()
ImBuf *bbuf= NULL;
int x, y, icontype;
char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
- char filenamestr[FILE_MAXFILE+16]; // 16 == strlen(".blender/icons/")+1
if ((btheme!=NULL) && (strlen(btheme->tui.iconfile) > 0)) {
-
-#ifdef WIN32
- sprintf(filenamestr, "icons/%s", btheme->tui.iconfile);
-#else
- sprintf(filenamestr, ".blender/icons/%s", btheme->tui.iconfile);
-#endif
-
- BLI_make_file_string("/", iconfilestr, BLI_gethome(), filenamestr);
-
- if (BLI_exists(iconfilestr)) {
- bbuf = IMB_loadiffname(iconfilestr, IB_rect);
- if(bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H) {
- if (G.f & G_DEBUG)
- printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
- IMB_freeImBuf(bbuf);
- bbuf= NULL;
+ char *datadir= BLI_get_folder(BLENDER_DATAFILES, NULL);
+ if (datadir) {
+ BLI_make_file_string("/", iconfilestr, datadir, btheme->tui.iconfile);
+
+ if (BLI_exists(iconfilestr)) {
+ bbuf = IMB_loadiffname(iconfilestr, IB_rect);
+ if(bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H) {
+ if (G.f & G_DEBUG)
+ printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
+ IMB_freeImBuf(bbuf);
+ bbuf= NULL;
+ }
}
}
}
@@ -555,14 +550,14 @@ static void init_iconfile_list(struct ListBase *list)
char icondirstr[FILE_MAX];
char iconfilestr[FILE_MAX+16]; /* allow 256 chars for file+dir */
char olddir[FILE_MAX];
-
+ char *datadir= NULL;
+
list->first = list->last = NULL;
+ datadir = BLI_get_folder(BLENDER_DATAFILES, NULL);
-#ifdef WIN32
- BLI_make_file_string("/", icondirstr, BLI_gethome(), "icons");
-#else
- BLI_make_file_string("/", icondirstr, BLI_gethome(), ".blender/icons");
-#endif
+ if (!datadir) return;
+
+ BLI_make_file_string("/", icondirstr, datadir, "");
if(BLI_exists(icondirstr)==0)
return;
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 7c2a2f436cc..55a44b36a52 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -391,7 +391,7 @@ static int bookmark_add_exec(bContext *C, wmOperator *op)
char name[FILE_MAX];
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, params->dir, 0, 1);
- BLI_make_file_string("/", name, BLI_gethome(), ".Bfs");
+ BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu, name);
}
@@ -423,7 +423,7 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
char name[FILE_MAX];
fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index);
- BLI_make_file_string("/", name, BLI_gethome(), ".Bfs");
+ BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu, name);
ED_area_tag_redraw(sa);
}
@@ -619,7 +619,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
folderlist_free(sfile->folders_next);
fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1);
- BLI_make_file_string(G.sce, filepath, BLI_gethome(), ".Bfs");
+ BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu_get(), filepath);
WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC);
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 08a6b5a8f34..a7d6288c3c9 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -248,7 +248,37 @@ void fsmenu_write_file(struct FSMenu* fsmenu, const char *filename)
fclose(fp);
}
-void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
+void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename)
+{
+ char line[256];
+ FSMenuCategory category = FS_CATEGORY_BOOKMARKS;
+ FILE *fp;
+
+ fp = fopen(filename, "r");
+ if (!fp) return;
+
+ while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
+ {
+ if (strncmp(line, "[Bookmarks]", 11)==0){
+ category = FS_CATEGORY_BOOKMARKS;
+ } else if (strncmp(line, "[Recent]", 8)==0){
+ category = FS_CATEGORY_RECENT;
+ } else {
+ int len = strlen(line);
+ if (len>0) {
+ if (line[len-1] == '\n') {
+ line[len-1] = '\0';
+ }
+ if (BLI_exist(line)) {
+ fsmenu_insert_entry(fsmenu, category, line, 0, 1);
+ }
+ }
+ }
+ }
+ fclose(fp);
+}
+
+void fsmenu_read_system(struct FSMenu* fsmenu)
{
char line[256];
FSMenuCategory category = FS_CATEGORY_BOOKMARKS;
@@ -482,31 +512,9 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
}
#endif
#endif
-
- fp = fopen(filename, "r");
- if (!fp) return;
-
- while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
- {
- if (strncmp(line, "[Bookmarks]", 11)==0){
- category = FS_CATEGORY_BOOKMARKS;
- } else if (strncmp(line, "[Recent]", 8)==0){
- category = FS_CATEGORY_RECENT;
- } else {
- int len = strlen(line);
- if (len>0) {
- if (line[len-1] == '\n') {
- line[len-1] = '\0';
- }
- if (BLI_exist(line)) {
- fsmenu_insert_entry(fsmenu, category, line, 0, 1);
- }
- }
- }
- }
- fclose(fp);
}
+
static void fsmenu_free_category(struct FSMenu* fsmenu, FSMenuCategory category)
{
FSMenuEntry *fsme= fsmenu_get_category(fsmenu, category);
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index 8304b104a4f..dcf8d3eb632 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -68,7 +68,10 @@ void fsmenu_remove_entry (struct FSMenu* fsmenu, FSMenuCategory category, int i
void fsmenu_write_file (struct FSMenu* fsmenu, const char *filename);
/** reads the 'bookmarks' from the specified file */
-void fsmenu_read_file (struct FSMenu* fsmenu, const char *filename);
+void fsmenu_read_bookmarks (struct FSMenu* fsmenu, const char *filename);
+
+ /** adds system specific directories */
+void fsmenu_read_system (struct FSMenu* fsmenu);
/** Free's all the memory associated with the fsmenu */
void fsmenu_free (struct FSMenu* fsmenu);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 300a72851a4..261b7058151 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -591,9 +591,16 @@ void ED_spacetype_file(void)
void ED_file_init(void)
{
- char name[FILE_MAX];
- BLI_make_file_string("/", name, BLI_gethome(), ".Bfs");
- fsmenu_read_file(fsmenu_get(), name);
+ char *cfgdir = BLI_get_folder(BLENDER_CONFIG, NULL);
+
+ fsmenu_read_system(fsmenu_get());
+
+ if (cfgdir) {
+ char name[FILE_MAX];
+ BLI_make_file_string("/", name, cfgdir, BLENDER_BOOKMARK_FILE);
+ fsmenu_read_bookmarks(fsmenu_get(), name);
+ }
+
filelist_init_icons();
IMB_thumb_makedirs();
}
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index b38e1473a0c..4e1918bc327 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -11,6 +11,7 @@ defs = []
if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
+ incs += ' ' + env['BF_LCMS_INC']
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
if env['WITH_BF_TIFF']:
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 0d9f1c90489..0f483f4bcec 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -38,6 +38,7 @@
#include "BKE_context.h"
#include "BKE_colortools.h"
+#include "BKE_global.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
@@ -49,7 +50,7 @@
#include "WM_types.h"
#include "UI_resources.h"
-
+#include "UI_interface.h"
#include "info_intern.h" // own include
@@ -179,6 +180,31 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
}
+static void recent_files_menu(const bContext *C, Menu *menu)
+{
+ struct RecentFile *recent;
+ uiLayout *layout= menu->layout;
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
+ if (G.recent_files.first) {
+ for(recent = G.recent_files.first; (recent); recent = recent->next) {
+ uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ }
+ } else {
+ uiItemL(layout, "No Recent Files", 0);
+ }
+}
+
+void recent_files_menu_register()
+{
+ MenuType *mt;
+
+ mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
+ strcpy(mt->idname, "INFO_MT_file_open_recent");
+ strcpy(mt->label, "Open Recent...");
+ mt->draw= recent_files_menu;
+ WM_menutype_add(mt);
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_info(void)
{
@@ -217,7 +243,8 @@ void ED_spacetype_info(void)
BLI_addhead(&st->regiontypes, art);
-
+ recent_files_menu_register();
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index c4ee90dde16..bd500adc8e4 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -37,7 +37,8 @@ if env['WITH_BF_QUICKTIME']:
if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
-
+ incs += ' ' + env['BF_LCMS_INC']
+
if env['WITH_BF_GAMEENGINE']:
defs.append('GAMEBLENDER=1')
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 8601ad96345..b978e46f6da 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -145,7 +145,7 @@ void BPy_init_modules( void )
PyObject *mod;
/* Needs to be first since this dir is needed for future modules */
- char *modpath= BLI_gethome_folder("scripts/modules", BLI_GETHOME_ALL);
+ char *modpath= BLI_get_folder(BLENDER_SCRIPTS, "modules");
if(modpath) {
// printf("bpy: found module path '%s'.\n", modpath);
PyObject *sys_path= PySys_GetObject("path"); /* borrow */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 000d428e40f..6a1495b5f65 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -177,7 +177,7 @@ static PyObject *CreateGlobalDictionary( bContext *C, const char *filename )
/* must be called before Py_Initialize */
void BPY_start_python_path(void)
{
- char *py_path_bundle= BLI_gethome_folder("python", BLI_GETHOME_ALL);
+ char *py_path_bundle= BLI_get_folder(BLENDER_PYTHON, NULL);
if(py_path_bundle==NULL)
return;
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 5298711ef52..d926bbfed80 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -103,7 +103,7 @@
#include "wm_window.h"
#include "wm_event_system.h"
-static void writeBlog(void);
+static void write_history(void);
/* To be able to read files without windows closing, opening, moving
we try to prepare for worst case:
@@ -298,7 +298,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
if (retval!=0) {
G.relbase_valid = 1;
if(!G.background) /* assume automated tasks with background, dont write recent file list */
- writeBlog();
+ write_history();
}
// XXX undo_editmode_clear();
@@ -333,17 +333,23 @@ int WM_read_homefile(bContext *C, wmOperator *op)
{
ListBase wmbase;
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
- char *home= BLI_gethome();
int from_memory= op?RNA_boolean_get(op->ptr, "factory"):0;
int success;
-
- BLI_clean(home);
free_ttfont(); /* still weird... what does it here? */
G.relbase_valid = 0;
if (!from_memory) {
- BLI_make_file_string(G.sce, tstr, home, ".B25.blend");
+ char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
+ if (cfgdir) {
+ BLI_make_file_string(G.sce, tstr, cfgdir, BLENDER_STARTUP_FILE);
+ } else {
+ tstr[0] = '\0';
+ from_memory = 1;
+ if (op) {
+ BKE_report(op->reports, RPT_INFO, "Config directory with startup.blend file found.");
+ }
+ }
}
strcpy(scestr, G.sce); /* temporary store */
@@ -391,15 +397,19 @@ int WM_read_homefile(bContext *C, wmOperator *op)
}
-void read_Blog(void)
+void read_history(void)
{
char name[FILE_MAX];
LinkNode *l, *lines;
struct RecentFile *recent;
char *line;
int num;
+ char *cfgdir = BLI_get_folder(BLENDER_CONFIG, NULL);
+
+ if (!cfgdir) return;
+
+ BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE);
- BLI_make_file_string("/", name, BLI_gethome(), ".Blog");
lines= BLI_read_file_as_lines(name);
G.recent_files.first = G.recent_files.last = NULL;
@@ -428,14 +438,14 @@ void read_Blog(void)
}
-static void writeBlog(void)
+static void write_history(void)
{
struct RecentFile *recent, *next_recent;
char name[FILE_MAXDIR+FILE_MAXFILE];
FILE *fp;
int i;
- BLI_make_file_string("/", name, BLI_gethome(), ".Blog");
+ BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_HISTORY_FILE);
recent = G.recent_files.first;
/* refresh .Blog of recent opened files, when current file was changed */
@@ -620,7 +630,7 @@ int WM_write_file(bContext *C, char *target, int fileflags, ReportList *reports)
if(fileflags & G_FILE_AUTOPLAY) G.fileflags |= G_FILE_AUTOPLAY;
else G.fileflags &= ~G_FILE_AUTOPLAY;
- writeBlog();
+ write_history();
/* run this function after because the file cant be written before the blend is */
if (ibuf_thumb) {
@@ -652,7 +662,8 @@ int WM_write_homefile(bContext *C, wmOperator *op)
if(win->screen->full == SCREENTEMP)
wm_window_close(C, wm, win);
- BLI_make_file_string("/", tstr, BLI_gethome(), ".B25.blend");
+ BLI_make_file_string("/", tstr, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
+ printf("trying to save homefile at %s \n", tstr);
/* force save as regular blend file */
fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 02e645ef635..acb3f5ea254 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -163,7 +163,7 @@ void WM_init(bContext *C, int argc, char **argv)
G.ndofdevice = -1; /* XXX bad initializer, needs set otherwise buttons show! */
- read_Blog();
+ read_history();
BLI_strncpy(G.lib, G.sce, FILE_MAX);
}
diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h
index c633ed8388e..15a38251795 100644
--- a/source/blender/windowmanager/wm_files.h
+++ b/source/blender/windowmanager/wm_files.h
@@ -28,7 +28,7 @@
#ifndef WM_FILES_H
#define WM_FILES_H
-extern void read_Blog(void);
+extern void read_history(void);
extern void delete_autosave(void);
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 11997550ee1..b4d9be59b59 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -210,18 +210,16 @@ IF(WITH_INSTALL)
COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
- COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/.blender
- COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
- COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
+ COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles
+ COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
+ COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
)
IF(WITH_INTERNATIONAL)
ADD_CUSTOM_COMMAND(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
- COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
- COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/Resources/
- COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
- COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/Resources/
+ COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
+ COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
)
ENDIF(WITH_INTERNATIONAL)
@@ -233,9 +231,10 @@ IF(WITH_INSTALL)
ENDIF(WITH_LIBS10.5)
ADD_CUSTOM_COMMAND(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
- COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
- COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/
- COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/
+ COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/scripts/
+ COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/python/
+ COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/python/
+ COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/python/
COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
)
ENDIF(WITH_PYTHON)
diff --git a/tools/Blender.py b/tools/Blender.py
index 6356210b113..cd6e4652754 100644
--- a/tools/Blender.py
+++ b/tools/Blender.py
@@ -145,6 +145,8 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
if lenv['WITH_BF_STATICOPENEXR']:
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
+ if lenv['WITH_BF_LCMS']:
+ libincs += Split(lenv['BF_LCMS_LIBPATH'])
if lenv['WITH_BF_TIFF']:
libincs += Split(lenv['BF_TIFF_LIBPATH'])
if lenv['WITH_BF_FFTW3']:
diff --git a/tools/btools.py b/tools/btools.py
index e76ada3a985..a703103c59c 100644
--- a/tools/btools.py
+++ b/tools/btools.py
@@ -73,7 +73,7 @@ def validate_arguments(args, bc):
'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE',
'BF_X264_CONFIG',
'BF_XVIDCORE_CONFIG',
- 'WITH_BF_LCMS', 'BF_LCMS_LIB',
+ 'WITH_BF_LCMS', 'BF_LCMS', 'BF_LCMS_INC', 'BF_LCMS_LIB', 'BF_LCMS_LIBPATH',
'WITH_BF_DOCS',
'BF_NUMJOBS',
'BF_MSVS',
@@ -261,12 +261,18 @@ def read_opts(env, cfg, args):
('BF_PNG_LIB', 'PNG library', ''),
('BF_PNG_LIBPATH', 'PNG library path', ''),
- (BoolVariable('WITH_BF_TIFF', 'Use TIFF if true', True)),
+ (BoolVariable('WITH_BF_TIFF', 'Use TIFF if true', True)),
('BF_TIFF', 'TIFF base path', ''),
('BF_TIFF_INC', 'TIFF include path', ''),
('BF_TIFF_LIB', 'TIFF library', ''),
('BF_TIFF_LIBPATH', 'TIFF library path', ''),
+ (BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)),
+ ('BF_LCMS', 'LCMS base path', ''),
+ ('BF_LCMS_INC', 'LCMS include path', ''),
+ ('BF_LCMS_LIB', 'LCMS library', ''),
+ ('BF_LCMS_LIBPATH', 'LCMS library path', ''),
+
(BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
('BF_ZLIB', 'ZLib base path', ''),
('BF_ZLIB_INC', 'ZLib include path', ''),
@@ -418,9 +424,6 @@ def read_opts(env, cfg, args):
(BoolVariable('WITH_BF_LZO', 'Enable fast LZO pointcache compression', True)),
(BoolVariable('WITH_BF_LZMA', 'Enable best LZMA pointcache compression', True)),
- (BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)),
- ('BF_LCMS_LIB', 'LCMSlibrary', 'lcms'),
-
('BF_X264_CONFIG', 'configuration flags for x264', ''),
('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
(BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),