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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-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
23 files changed, 604 insertions, 396 deletions
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)