Adds support for utf paths on Windows.
Not all file formats/calls are supported yet. It will be expended. Please from now on use BLI_fopen, BLI_* for file manipulations. For non-windows systems BLI_fopen just calls fopen. For Windows, the utf-8 string is translated to utf-16 string in order to call UTF version of the function.
This commit is contained in:
@@ -136,4 +136,10 @@ if(WITH_BUILDINFO)
|
||||
add_definitions(-DWITH_BUILDINFO)
|
||||
endif()
|
||||
|
||||
if(WIN322)
|
||||
list(APPEND INC
|
||||
../../../intern/utfconv
|
||||
)
|
||||
endif()
|
||||
|
||||
blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
||||
@@ -32,6 +32,7 @@ if env['OURPLATFORM'] == 'linux':
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
|
||||
incs += ' ' + env['BF_PTHREADS_INC']
|
||||
incs += ' ../../intern/utfconv'
|
||||
|
||||
if env['OURPLATFORM'] != 'darwin' or env['WITH_GHOST_COCOA']:
|
||||
sources.remove('intern' + os.sep + 'wm_apple.c')
|
||||
|
||||
@@ -304,6 +304,7 @@ static void wm_init_userdef(bContext *C)
|
||||
#define BKE_READ_EXOTIC_OK_BLEND 0 /* .blend file */
|
||||
#define BKE_READ_EXOTIC_OK_OTHER 1 /* other supported formats */
|
||||
|
||||
|
||||
/* intended to check for non-blender formats but for now it only reads blends */
|
||||
static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
|
||||
{
|
||||
@@ -319,8 +320,7 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
|
||||
retval= BKE_READ_EXOTIC_FAIL_PATH;
|
||||
}
|
||||
else {
|
||||
gzfile = gzopen(name,"rb");
|
||||
|
||||
gzfile = BLI_gzopen(name,"rb");
|
||||
if (gzfile == NULL) {
|
||||
retval= BKE_READ_EXOTIC_FAIL_OPEN;
|
||||
}
|
||||
@@ -627,7 +627,7 @@ static void write_history(void)
|
||||
recent = G.recent_files.first;
|
||||
/* refresh recent-files.txt of recent opened files, when current file was changed */
|
||||
if(!(recent) || (BLI_path_cmp(recent->filepath, G.main->name)!=0)) {
|
||||
fp= fopen(name, "w");
|
||||
fp= BLI_fopen(name, "w");
|
||||
if (fp) {
|
||||
/* add current file to the beginning of list */
|
||||
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
|
||||
|
||||
Reference in New Issue
Block a user