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:
Diffstat (limited to 'source/blender/blenlib/intern/BLI_bfile.c')
-rw-r--r--source/blender/blenlib/intern/BLI_bfile.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/source/blender/blenlib/intern/BLI_bfile.c b/source/blender/blenlib/intern/BLI_bfile.c
index 9540b16d2f4..3306283ad3f 100644
--- a/source/blender/blenlib/intern/BLI_bfile.c
+++ b/source/blender/blenlib/intern/BLI_bfile.c
@@ -46,6 +46,8 @@
#include "BLI_storage.h"
#include "BLI_bfile.h"
+#include "GHOST_C-api.h"
+
/* Internal bfile classification flags */
#define BCF_OPEN (0)
#define BCF_FOPEN (1<<0)
@@ -54,6 +56,11 @@
#define BCF_AT_END (1<<3)
#define BCF_DISCARD (1<<4)
+/* Standard files names */
+#define LAST_SESSION_FILE "last-session"
+#define ENVIRONMENT_FILE "environment"
+
+
/* Declaration of internal functions */
void chomp(char* line);
void expand_envvars(char* src, char* dst);
@@ -221,19 +228,6 @@ void BLI_bfile_set_error(BFILE *bfile, int error) {
}
-#if defined(WIN32)
- #define LAST_SESSION_FILE "%HOME%\\Blender\\last-session FIXME FIXME FIXME"
- #define ENVIRONMENT_FILE "FIXME"
- #define SHARED_DIRECTORY "FIXME TOO"
-#elif defined(OSX)
- #define LAST_SESSION_FILE "${HOME}/Library/Application Support/Blender/last-session"
- #define ENVIRONMENT_FILE "${HOME}/Library/Application Support/Blender/${BLENDER_VERSION}/environment"
- #define SHARED_DIRECTORY "/Library/Application Support/Blender"
-#else
- #define LAST_SESSION_FILE "${HOME}/.blender/last-session"
- #define ENVIRONMENT_FILE "${HOME}/.blender/${BLENDER_VERSION}/environment"
- #define SHARED_DIRECTORY "/usr/share/blender"
-#endif
void BLI_bfile_init_vars() {
char file[MAXPATHLEN];
char temp[MAXPATHLEN];
@@ -249,10 +243,12 @@ void BLI_bfile_init_vars() {
if(BLI_exist(temp)) {
BLI_setenv_if_new("BLENDER_SHARE", dirname(bprogname));
} else {
- BLI_setenv_if_new("BLENDER_SHARE", SHARED_DIRECTORY);
+ BLI_setenv_if_new("BLENDER_SHARE", (const char*)GHOST_getSystemDir());
}
- expand_envvars(LAST_SESSION_FILE, file);
+ strcpy(file, (const char*)GHOST_getUserDir());
+ BLI_add_slash(file);
+ strcat(file, LAST_SESSION_FILE);
fp = fopen(file, "r");
/* 1st line, read previous version */
if (fp && (fscanf(fp, "%3c\n", temp) == 1)) {
@@ -283,7 +279,9 @@ void BLI_bfile_init_vars() {
}
/* Load vars from user and system files */
- expand_envvars(ENVIRONMENT_FILE, file);
+ strcpy(file, (const char *)GHOST_getUserDir());
+ BLI_add_slash(file);
+ strcat(file, ENVIRONMENT_FILE);
init_vars_from_file(file);
sprintf(temp, "/%d/environment", BLENDER_VERSION);
BLI_make_file_string("/", file, getenv("BLENDER_SHARE"), temp);