Added UTF8 international character support for file operations; see issue #413

This commit is contained in:
Oliver Duis
2010-12-18 17:41:03 +01:00
parent 1f2f3b1209
commit 94449dc9e4
29 changed files with 166 additions and 152 deletions

View File

@@ -24,6 +24,7 @@
#include <multilangmgr.h>
#include <safekeyfile.h>
#include <addsetids.h>
#include <safegtk.h>
Options options;
Glib::ustring versionString = "v3.0 alpha 1";
@@ -149,7 +150,7 @@ int Options::readFromFile (Glib::ustring fname) {
rtengine::SafeKeyFile keyFile;
try {
if( !Glib::file_test(fname,Glib::FILE_TEST_EXISTS))
if( !safe_file_test(fname,Glib::FILE_TEST_EXISTS))
return 1;
if (!keyFile.load_from_file (fname))
return 1;
@@ -424,7 +425,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab);
FILE *f = g_fopen (fname.c_str(), "wt");
FILE *f = safe_g_fopen (fname, "wt");
if (f==NULL)
return 1;
else {
@@ -444,9 +445,9 @@ void Options::load () {
cacheBaseDir = argv0 + "/cache";
if (options.multiUser) {
int r = options.readFromFile (rtdir + "/options");
if (r && !g_mkdir_with_parents (rtdir.c_str(), 511)) {
if (r && !safe_g_mkdir_with_parents (rtdir, 511)) {
Glib::ustring profdir = rtdir + "/profiles";
g_mkdir_with_parents (profdir.c_str(), 511);
safe_g_mkdir_with_parents (profdir, 511);
options.saveToFile (rtdir + "/options");
}
#ifdef _WIN32