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:
authorAlexander Kuznetsov <kuzsasha@gmail.com>2012-03-20 06:17:37 +0400
committerAlexander Kuznetsov <kuzsasha@gmail.com>2012-03-20 06:17:37 +0400
commitf11a6d3a847e8e18faefd8694373d2f11b5ec802 (patch)
treeb4bec6dcfd28e3da4fa1e84ee4bd20fa0a21be39 /source/blender/blenkernel/intern
parentdeea1f38b1ec0ccba283abeb63506cbc15e093d5 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/blender.c2
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c4
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/movieclip.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c6
-rw-r--r--source/blender/blenkernel/intern/particle_system.c2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c6
-rw-r--r--source/blender/blenkernel/intern/text.c5
8 files changed, 15 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 30f4e9f2816..2ef93dd7fa3 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -717,7 +717,7 @@ void BKE_undo_save_quit(void)
BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
- file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+ file = BLI_open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
if(file == -1) {
//XXX error("Unable to save %s, check you have permissions", str);
return;
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 4386132fc18..5538267a5f1 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -279,7 +279,7 @@ int cdf_read_open(CDataFile *cdf, const char *filename)
{
FILE *f;
- f= fopen(filename, "rb");
+ f= BLI_fopen(filename, "rb");
if(!f)
return 0;
@@ -350,7 +350,7 @@ int cdf_write_open(CDataFile *cdf, const char *filename)
CDataFileMeshHeader *mesh;
FILE *f;
- f= fopen(filename, "wb");
+ f= BLI_fopen(filename, "wb");
if(!f)
return 0;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 4300995b68c..053ebf654f0 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -521,7 +521,7 @@ Image *BKE_add_image_file(const char *name)
BLI_path_abs(str, G.main->name);
/* exists? */
- file= open(str, O_BINARY|O_RDONLY);
+ file= BLI_open(str, O_BINARY|O_RDONLY, 0);
if(file== -1) return NULL;
close(file);
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 0af6b9dd219..1b415f1654f 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -411,7 +411,7 @@ MovieClip *BKE_add_movieclip_file(const char *name)
BLI_path_abs(str, G.main->name);
/* exists? */
- file= open(str, O_BINARY|O_RDONLY);
+ file= BLI_open(str, O_BINARY|O_RDONLY,0);
if(file== -1) return NULL;
close(file);
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 4230510dac9..64ccdf9b843 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -186,7 +186,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
// open the file
// and create a PackedFile structure
- file= open(name, O_BINARY|O_RDONLY);
+ file= BLI_open(name, O_BINARY|O_RDONLY,0);
if (file <= 0) {
BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name);
} else {
@@ -292,7 +292,7 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
// make sure the path to the file exists...
BLI_make_existing_file(name);
- file = open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
+ file = BLI_open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
if (file >= 0) {
if (write(file, pf->data, pf->size) != pf->size) {
BKE_reportf(reports, RPT_ERROR, "Error writing file: %s", name);
@@ -347,7 +347,7 @@ int checkPackedFile(const char *filename, PackedFile *pf)
} else {
// we'll have to compare the two...
- file = open(name, O_BINARY | O_RDONLY);
+ file = BLI_open(name, O_BINARY | O_RDONLY, 0);
if (file < 0) {
ret_val = PF_NOFILE;
} else {
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index a0668d621e8..978971a04a4 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4073,7 +4073,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
- gzf = gzopen(filename, "rb");
+ gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s' \n", filename);
// XXX bad level call elbeemDebugOut(debugStrBuffer);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 69e96c7a698..a2425b0a3ac 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1144,13 +1144,13 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
if (!BLI_exists(filename)) {
return NULL;
}
- fp = fopen(filename, "rb");
+ fp = BLI_fopen(filename, "rb");
} else if (mode==PTCACHE_FILE_WRITE) {
BLI_make_existing_file(filename); /* will create the dir if needs be, same as //textures is created */
- fp = fopen(filename, "wb");
+ fp = BLI_fopen(filename, "wb");
} else if (mode==PTCACHE_FILE_UPDATE) {
BLI_make_existing_file(filename);
- fp = fopen(filename, "rb+");
+ fp = BLI_fopen(filename, "rb+");
}
if (!fp)
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index ffb8e830ed4..66759edde65 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -44,6 +44,7 @@
#include "BLI_string_utf8.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_fileops.h"
#include "DNA_constraint_types.h"
#include "DNA_controller_types.h"
@@ -291,7 +292,7 @@ int reopen_text(Text *text)
BLI_strncpy(str, text->name, FILE_MAX);
BLI_path_abs(str, G.main->name);
- fp= fopen(str, "r");
+ fp= BLI_fopen(str, "r");
if(fp==NULL) return 0;
/* free memory: */
@@ -387,7 +388,7 @@ Text *add_text(const char *file, const char *relpath)
if (relpath) /* can be NULL (bg mode) */
BLI_path_abs(str, relpath);
- fp= fopen(str, "r");
+ fp= BLI_fopen(str, "r");
if(fp==NULL) return NULL;
ta= alloc_libblock(&bmain->text, ID_TXT, BLI_path_basename(str));