forked from bartvdbraak/blender
Code cleanup: don't use btempdir/bprogdir/bprogname globals anymore, but wrap
in BLI_ functions.
This commit is contained in:
parent
4d48dbe5fd
commit
00735ed9e4
@ -549,7 +549,7 @@ void BKE_write_undo(bContext *C, const char *name)
|
|||||||
counter= counter % U.undosteps;
|
counter= counter % U.undosteps;
|
||||||
|
|
||||||
BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter);
|
BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter);
|
||||||
BLI_make_file_string("/", filepath, btempdir, numstr);
|
BLI_make_file_string("/", filepath, BLI_temporary_dir(), numstr);
|
||||||
|
|
||||||
/* success= */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL);
|
/* success= */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL);
|
||||||
|
|
||||||
@ -719,7 +719,7 @@ void BKE_undo_save_quit(void)
|
|||||||
/* no undo state to save */
|
/* no undo state to save */
|
||||||
if(undobase.first==undobase.last) return;
|
if(undobase.first==undobase.last) return;
|
||||||
|
|
||||||
BLI_make_file_string("/", str, btempdir, "quit.blend");
|
BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
|
||||||
|
|
||||||
file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
|
file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
|
||||||
if(file == -1) {
|
if(file == -1) {
|
||||||
|
@ -923,8 +923,8 @@ static int ptcache_path(PTCacheID *pid, char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* use the temp path. this is weak but better then not using point cache at all */
|
/* use the temp path. this is weak but better then not using point cache at all */
|
||||||
/* btempdir is assumed to exist and ALWAYS has a trailing slash */
|
/* temporary directory is assumed to exist and ALWAYS has a trailing slash */
|
||||||
BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid()));
|
BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", BLI_temporary_dir(), abs(getpid()));
|
||||||
|
|
||||||
return BLI_add_slash(filename); /* new strlen() */
|
return BLI_add_slash(filename); /* new strlen() */
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,6 @@ struct ListBase;
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern char btempdir[]; /* creator.c temp dir used instead of U.tempdir, set with BLI_where_is_temp( btempdir, 1 ); */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -181,29 +181,20 @@ void BLI_path_rel(char *file, const char *relfile);
|
|||||||
*/
|
*/
|
||||||
void BLI_char_switch(char *string, char from, char to);
|
void BLI_char_switch(char *string, char from, char to);
|
||||||
|
|
||||||
/**
|
/* Initialize path to program executable */
|
||||||
* Checks if name is a fully qualified filename to an executable.
|
void BLI_init_program_path(const char *argv0);
|
||||||
* If not it searches $PATH for the file. On Windows it also
|
/* Initialize path to temporary directory.
|
||||||
* adds the correct extension (.com .exe etc) from
|
* NOTE: On Window userdir will be set to the temporary directory! */
|
||||||
* $PATHEXT if necessary. Also on Windows it translates
|
void BLI_init_temporary_dir(char *userdir);
|
||||||
* the name to its 8.3 version to prevent problems with
|
|
||||||
* spaces and stuff. Final result is returned in fullname.
|
|
||||||
*
|
|
||||||
* @param fullname The full path and full name of the executable
|
|
||||||
* @param name The name of the executable (usually argv[0]) to be checked
|
|
||||||
*/
|
|
||||||
void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the temp directory when blender first runs.
|
|
||||||
* If the default path is not found, use try $TEMP
|
|
||||||
*
|
|
||||||
* Also make sure the temp dir has a trailing slash
|
|
||||||
*
|
|
||||||
* @param fullname The full path to the temp directory
|
|
||||||
*/
|
|
||||||
void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp);
|
|
||||||
|
|
||||||
|
/* Path to executable */
|
||||||
|
const char *BLI_program_path(void);
|
||||||
|
/* Path to directory of executable */
|
||||||
|
const char *BLI_program_dir(void);
|
||||||
|
/* Path to temporary directory (with trailing slash) */
|
||||||
|
const char *BLI_temporary_dir(void);
|
||||||
|
/* Path to the system temporary directory (with trailing slash) */
|
||||||
|
void BLI_system_temporary_dir(char *dir);
|
||||||
|
|
||||||
#ifdef WITH_ICONV
|
#ifdef WITH_ICONV
|
||||||
void BLI_string_to_utf8(char *original, char *utf_8, const char *code);
|
void BLI_string_to_utf8(char *original, char *utf_8, const char *code);
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "DNA_userdef_types.h"
|
#include "DNA_listBase.h"
|
||||||
|
|
||||||
#include "BLI_fileops.h"
|
#include "BLI_fileops.h"
|
||||||
#include "BLI_path_util.h"
|
#include "BLI_path_util.h"
|
||||||
@ -87,8 +87,9 @@
|
|||||||
/* local */
|
/* local */
|
||||||
#define UNIQUE_NAME_MAX 128
|
#define UNIQUE_NAME_MAX 128
|
||||||
|
|
||||||
extern char bprogname[];
|
static char bprogname[FILE_MAX]; /* path to program executable */
|
||||||
extern char bprogdir[];
|
static char bprogdir[FILE_MAX]; /* path in which executable is located */
|
||||||
|
static char btempdir[FILE_MAX]; /* temporary directory */
|
||||||
|
|
||||||
static int add_win32_extension(char *name);
|
static int add_win32_extension(char *name);
|
||||||
static char *blender_version_decimal(const int ver);
|
static char *blender_version_decimal(const int ver);
|
||||||
@ -1670,8 +1671,19 @@ static int add_win32_extension(char *name)
|
|||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* filename must be FILE_MAX length minimum */
|
/*
|
||||||
void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name)
|
* Checks if name is a fully qualified filename to an executable.
|
||||||
|
* If not it searches $PATH for the file. On Windows it also
|
||||||
|
* adds the correct extension (.com .exe etc) from
|
||||||
|
* $PATHEXT if necessary. Also on Windows it translates
|
||||||
|
* the name to its 8.3 version to prevent problems with
|
||||||
|
* spaces and stuff. Final result is returned in fullname.
|
||||||
|
*
|
||||||
|
* @param fullname The full path and full name of the executable
|
||||||
|
* (must be FILE_MAX minimum)
|
||||||
|
* @param name The name of the executable (usually argv[0]) to be checked
|
||||||
|
*/
|
||||||
|
static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name)
|
||||||
{
|
{
|
||||||
char filename[FILE_MAXDIR+FILE_MAXFILE];
|
char filename[FILE_MAXDIR+FILE_MAXFILE];
|
||||||
const char *path = NULL, *temp;
|
const char *path = NULL, *temp;
|
||||||
@ -1751,12 +1763,37 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp)
|
void BLI_init_program_path(const char *argv0)
|
||||||
|
{
|
||||||
|
bli_where_am_i(bprogname, sizeof(bprogname), argv0);
|
||||||
|
BLI_split_dir_part(bprogname, bprogdir, sizeof(bprogdir));
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *BLI_program_path(void)
|
||||||
|
{
|
||||||
|
return bprogname;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *BLI_program_dir(void)
|
||||||
|
{
|
||||||
|
return bprogdir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the temp directory when blender first runs.
|
||||||
|
* If the default path is not found, use try $TEMP
|
||||||
|
*
|
||||||
|
* Also make sure the temp dir has a trailing slash
|
||||||
|
*
|
||||||
|
* @param fullname The full path to the temp directory
|
||||||
|
* @param userdir Directory specified in user preferences
|
||||||
|
*/
|
||||||
|
void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir)
|
||||||
{
|
{
|
||||||
fullname[0] = '\0';
|
fullname[0] = '\0';
|
||||||
|
|
||||||
if (usertemp && BLI_is_dir(U.tempdir)) {
|
if (userdir && BLI_is_dir(userdir)) {
|
||||||
BLI_strncpy(fullname, U.tempdir, maxlen);
|
BLI_strncpy(fullname, userdir, maxlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1790,13 +1827,28 @@ void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp)
|
|||||||
/* add a trailing slash if needed */
|
/* add a trailing slash if needed */
|
||||||
BLI_add_slash(fullname);
|
BLI_add_slash(fullname);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if(U.tempdir != fullname) {
|
if(userdir != fullname) {
|
||||||
BLI_strncpy(U.tempdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */
|
BLI_strncpy(userdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BLI_init_temporary_dir(char *userdir)
|
||||||
|
{
|
||||||
|
BLI_where_is_temp(btempdir, FILE_MAX, userdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *BLI_temporary_dir(void)
|
||||||
|
{
|
||||||
|
return btempdir;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BLI_system_temporary_dir(char *dir)
|
||||||
|
{
|
||||||
|
BLI_where_is_temp(dir, FILE_MAX, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WITH_ICONV
|
#ifdef WITH_ICONV
|
||||||
|
|
||||||
void BLI_string_to_utf8(char *original, char *utf_8, const char *code)
|
void BLI_string_to_utf8(char *original, char *utf_8, const char *code)
|
||||||
|
@ -1127,7 +1127,7 @@ void init_userdef_do_versions(void)
|
|||||||
}
|
}
|
||||||
if(U.mixbufsize==0) U.mixbufsize= 2048;
|
if(U.mixbufsize==0) U.mixbufsize= 2048;
|
||||||
if (strcmp(U.tempdir, "/") == 0) {
|
if (strcmp(U.tempdir, "/") == 0) {
|
||||||
BLI_where_is_temp(U.tempdir, sizeof(U.tempdir), FALSE);
|
BLI_system_temporary_dir(U.tempdir);
|
||||||
}
|
}
|
||||||
if (U.autokey_mode == 0) {
|
if (U.autokey_mode == 0) {
|
||||||
/* 'add/replace' but not on */
|
/* 'add/replace' but not on */
|
||||||
|
@ -295,8 +295,7 @@ static void rna_userdef_addon_remove(bAddon *bext)
|
|||||||
|
|
||||||
static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
||||||
{
|
{
|
||||||
extern char btempdir[];
|
BLI_init_temporary_dir(U.tempdir);
|
||||||
BLI_where_is_temp(btempdir, FILE_MAX, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
|
||||||
|
@ -105,7 +105,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
|
|||||||
|
|
||||||
/* elubie: changed this to default to the same dir as the render output
|
/* elubie: changed this to default to the same dir as the render output
|
||||||
to prevent saving to C:\ on Windows */
|
to prevent saving to C:\ on Windows */
|
||||||
BLI_strncpy(fss->surfdataPath, btempdir, FILE_MAX);
|
BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), FILE_MAX);
|
||||||
|
|
||||||
// first init of bounding box
|
// first init of bounding box
|
||||||
// no bounding box needed
|
// no bounding box needed
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
#ifndef BPY_EXTERN_H
|
#ifndef BPY_EXTERN_H
|
||||||
#define BPY_EXTERN_H
|
#define BPY_EXTERN_H
|
||||||
|
|
||||||
extern char bprogname[]; /* holds a copy of argv[0], from creator.c */
|
|
||||||
|
|
||||||
struct Text; /* defined in DNA_text_types.h */
|
struct Text; /* defined in DNA_text_types.h */
|
||||||
struct ID; /* DNA_ID.h */
|
struct ID; /* DNA_ID.h */
|
||||||
struct Object; /* DNA_object_types.h */
|
struct Object; /* DNA_object_types.h */
|
||||||
|
@ -93,8 +93,6 @@ static PyStructSequence_Desc app_info_desc= {
|
|||||||
|
|
||||||
static PyObject *make_app_info(void)
|
static PyObject *make_app_info(void)
|
||||||
{
|
{
|
||||||
extern char bprogname[]; /* argv[0] from creator.c */
|
|
||||||
|
|
||||||
PyObject *app_info;
|
PyObject *app_info;
|
||||||
int pos= 0;
|
int pos= 0;
|
||||||
|
|
||||||
@ -118,7 +116,7 @@ static PyObject *make_app_info(void)
|
|||||||
SetStrItem("");
|
SetStrItem("");
|
||||||
#endif
|
#endif
|
||||||
SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));
|
SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));
|
||||||
SetStrItem(bprogname);
|
SetStrItem(BLI_program_path());
|
||||||
SetObjItem(PyBool_FromLong(G.background));
|
SetObjItem(PyBool_FromLong(G.background));
|
||||||
|
|
||||||
/* build info */
|
/* build info */
|
||||||
@ -200,8 +198,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
|
|||||||
|
|
||||||
static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
||||||
{
|
{
|
||||||
extern char btempdir[];
|
return PyC_UnicodeFromByte(BLI_temporary_dir());
|
||||||
return PyC_UnicodeFromByte(btempdir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
||||||
|
@ -193,9 +193,9 @@ void BPY_python_start(int argc, const char **argv)
|
|||||||
PyThreadState *py_tstate= NULL;
|
PyThreadState *py_tstate= NULL;
|
||||||
|
|
||||||
/* not essential but nice to set our name */
|
/* not essential but nice to set our name */
|
||||||
static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */
|
static wchar_t program_path_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */
|
||||||
BLI_strncpy_wchar_from_utf8(bprogname_wchar, bprogname, sizeof(bprogname_wchar) / sizeof(wchar_t));
|
BLI_strncpy_wchar_from_utf8(program_path_wchar, BLI_program_path(), sizeof(program_path_wchar) / sizeof(wchar_t));
|
||||||
Py_SetProgramName(bprogname_wchar);
|
Py_SetProgramName(program_path_wchar);
|
||||||
|
|
||||||
/* must run before python initializes */
|
/* must run before python initializes */
|
||||||
PyImport_ExtendInittab(bpy_internal_modules);
|
PyImport_ExtendInittab(bpy_internal_modules);
|
||||||
|
@ -478,7 +478,7 @@ static void scene_unique_exr_name(Scene *scene, char *str, int sample)
|
|||||||
else
|
else
|
||||||
BLI_snprintf(name, sizeof(name), "%s_%s%d.exr", fi, scene->id.name+2, sample);
|
BLI_snprintf(name, sizeof(name), "%s_%s%d.exr", fi, scene->id.name+2, sample);
|
||||||
|
|
||||||
BLI_make_file_string("/", str, btempdir, name);
|
BLI_make_file_string("/", str, BLI_temporary_dir(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void render_unique_exr_name(Render *re, char *str, int sample)
|
static void render_unique_exr_name(Render *re, char *str, int sample)
|
||||||
|
@ -289,8 +289,9 @@ static void wm_init_userdef(bContext *C)
|
|||||||
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC;
|
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC;
|
||||||
else G.f &= ~G_SCRIPT_AUTOEXEC;
|
else G.f &= ~G_SCRIPT_AUTOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update tempdir from user preferences */
|
/* update tempdir from user preferences */
|
||||||
BLI_where_is_temp(btempdir, FILE_MAX, 1);
|
BLI_init_temporary_dir(U.tempdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -856,14 +857,14 @@ void wm_autosave_location(char *filepath)
|
|||||||
* BLI_make_file_string will create string that has it most likely on C:\
|
* BLI_make_file_string will create string that has it most likely on C:\
|
||||||
* through get_default_root().
|
* through get_default_root().
|
||||||
* If there is no C:\tmp autosave fails. */
|
* If there is no C:\tmp autosave fails. */
|
||||||
if (!BLI_exists(btempdir)) {
|
if (!BLI_exists(BLI_temporary_dir())) {
|
||||||
savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL);
|
savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL);
|
||||||
BLI_make_file_string("/", filepath, savedir, pidstr);
|
BLI_make_file_string("/", filepath, savedir, pidstr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BLI_make_file_string("/", filepath, btempdir, pidstr);
|
BLI_make_file_string("/", filepath, BLI_temporary_dir(), pidstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WM_autosave_init(wmWindowManager *wm)
|
void WM_autosave_init(wmWindowManager *wm)
|
||||||
@ -921,7 +922,7 @@ void wm_autosave_delete(void)
|
|||||||
|
|
||||||
if(BLI_exists(filename)) {
|
if(BLI_exists(filename)) {
|
||||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||||
BLI_make_file_string("/", str, btempdir, "quit.blend");
|
BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
|
||||||
|
|
||||||
/* if global undo; remove tempsave, otherwise rename */
|
/* if global undo; remove tempsave, otherwise rename */
|
||||||
if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0);
|
if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0);
|
||||||
|
@ -1807,7 +1807,7 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
|
|||||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||||
|
|
||||||
/* load file */
|
/* load file */
|
||||||
BLI_make_file_string("/", filename, btempdir, "quit.blend");
|
BLI_make_file_string("/", filename, BLI_temporary_dir(), "quit.blend");
|
||||||
WM_read_file(C, filename, op->reports);
|
WM_read_file(C, filename, op->reports);
|
||||||
|
|
||||||
G.fileflags &= ~G_FILE_RECOVER;
|
G.fileflags &= ~G_FILE_RECOVER;
|
||||||
|
@ -129,7 +129,6 @@ struct RenderResult *RE_GetResult(struct Render *re){return (struct RenderResult
|
|||||||
struct Render *RE_GetRender(const char *name){return (struct Render *) NULL;}
|
struct Render *RE_GetRender(const char *name){return (struct Render *) NULL;}
|
||||||
|
|
||||||
/* blenkernel */
|
/* blenkernel */
|
||||||
char btempdir[] = "";
|
|
||||||
void RE_FreeRenderResult(struct RenderResult *res){}
|
void RE_FreeRenderResult(struct RenderResult *res){}
|
||||||
struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty){return (struct RenderResult *) NULL;}
|
struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty){return (struct RenderResult *) NULL;}
|
||||||
void RE_GetResultImage(struct Render *re, struct RenderResult *rr){}
|
void RE_GetResultImage(struct Render *re, struct RenderResult *rr){}
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
|
|
||||||
#include "DNA_ID.h"
|
#include "DNA_ID.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
|
#include "DNA_userdef_types.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
|
|
||||||
@ -141,10 +142,6 @@ static int print_version(int argc, const char **argv, void *data);
|
|||||||
|
|
||||||
extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
|
extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
|
||||||
|
|
||||||
char bprogname[FILE_MAX];
|
|
||||||
char bprogdir[FILE_MAX];
|
|
||||||
char btempdir[FILE_MAX];
|
|
||||||
|
|
||||||
#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d)\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
|
#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d)\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
|
||||||
|
|
||||||
/* Initialize callbacks for the modules that need them */
|
/* Initialize callbacks for the modules that need them */
|
||||||
@ -1154,11 +1151,8 @@ int main(int argc, const char **argv)
|
|||||||
fpsetmask(0);
|
fpsetmask(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// copy path to executable in bprogname. playanim and creting runtimes
|
// initialize path to executable
|
||||||
// need this.
|
BLI_init_program_path(argv[0]);
|
||||||
|
|
||||||
BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]);
|
|
||||||
BLI_split_dir_part(bprogname, bprogdir, sizeof(bprogdir));
|
|
||||||
|
|
||||||
BLI_threadapi_init();
|
BLI_threadapi_init();
|
||||||
|
|
||||||
@ -1213,7 +1207,8 @@ int main(int argc, const char **argv)
|
|||||||
WM_init(C, argc, argv);
|
WM_init(C, argc, argv);
|
||||||
|
|
||||||
/* this is properly initialized with user defs, but this is default */
|
/* this is properly initialized with user defs, but this is default */
|
||||||
BLI_where_is_temp(btempdir, FILE_MAX, 1); /* call after loading the startup.blend so we can read U.tempdir */
|
/* call after loading the startup.blend so we can read U.tempdir */
|
||||||
|
BLI_init_temporary_dir(U.tempdir);
|
||||||
|
|
||||||
#ifdef WITH_SDL
|
#ifdef WITH_SDL
|
||||||
BLI_setenv("SDL_VIDEODRIVER", "dummy");
|
BLI_setenv("SDL_VIDEODRIVER", "dummy");
|
||||||
@ -1224,7 +1219,8 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
WM_init(C, argc, argv);
|
WM_init(C, argc, argv);
|
||||||
|
|
||||||
BLI_where_is_temp(btempdir, FILE_MAX, 0); /* call after loading the startup.blend so we can read U.tempdir */
|
/* don't use user preferences temp dir */
|
||||||
|
BLI_init_temporary_dir(NULL);
|
||||||
}
|
}
|
||||||
#ifdef WITH_PYTHON
|
#ifdef WITH_PYTHON
|
||||||
/**
|
/**
|
||||||
|
@ -76,9 +76,6 @@ extern "C"
|
|||||||
|
|
||||||
int GHOST_HACK_getFirstFile(char buf[]);
|
int GHOST_HACK_getFirstFile(char buf[]);
|
||||||
|
|
||||||
extern char bprogname[]; /* holds a copy of argv[0], from creator.c */
|
|
||||||
extern char btempdir[]; /* use this to store a valid temp directory */
|
|
||||||
|
|
||||||
// For BLF
|
// For BLF
|
||||||
#include "BLF_api.h"
|
#include "BLF_api.h"
|
||||||
#include "BLF_translation.h"
|
#include "BLF_translation.h"
|
||||||
@ -116,9 +113,6 @@ extern char datatoc_bfont_ttf[];
|
|||||||
const int kMinWindowWidth = 100;
|
const int kMinWindowWidth = 100;
|
||||||
const int kMinWindowHeight = 100;
|
const int kMinWindowHeight = 100;
|
||||||
|
|
||||||
char bprogname[FILE_MAX];
|
|
||||||
char bprogdir[FILE_MAX];
|
|
||||||
|
|
||||||
static void mem_error_cb(const char *errorStr)
|
static void mem_error_cb(const char *errorStr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s", errorStr);
|
fprintf(stderr, "%s", errorStr);
|
||||||
@ -380,8 +374,8 @@ int main(int argc, char** argv)
|
|||||||
signal (SIGFPE, SIG_IGN);
|
signal (SIGFPE, SIG_IGN);
|
||||||
#endif /* __alpha__ */
|
#endif /* __alpha__ */
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]);
|
BLI_init_program_path(argv[0]);
|
||||||
BLI_split_dir_part(bprogname, bprogdir, sizeof(bprogdir));
|
BLI_init_temporary_dir(NULL);
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
|
// Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
|
||||||
/*
|
/*
|
||||||
@ -786,7 +780,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bfd = load_game_data(bprogname, filename[0]? filename: NULL);
|
bfd = load_game_data(BLI_program_path(), filename[0]? filename: NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//::printf("game data loaded from %s\n", filename);
|
//::printf("game data loaded from %s\n", filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user