summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-08-10 22:13:22 +0100
committerCarl Hetherington <cth@carlh.net>2015-08-10 22:44:31 +0100
commitab778ced048cad27b7c10808acfa93861ea91fce (patch)
tree37e04b2b36ff78e3c901c5f650f50210ea018c8a /src
parentc14ea4bf3907eb2a4f643a445cc4b232a6d425ce (diff)
Set up for the correct handling of UTF-8 with Windows
paths before trying to access the config file. Fixes #654.
Diffstat (limited to 'src')
-rw-r--r--src/lib/util.cc24
-rw-r--r--src/lib/util.h1
-rw-r--r--src/tools/dcpomatic.cc2
-rw-r--r--src/tools/dcpomatic_batch.cc2
-rw-r--r--src/tools/dcpomatic_cli.cc3
-rw-r--r--src/tools/dcpomatic_create.cc1
-rw-r--r--src/tools/dcpomatic_kdm.cc3
-rw-r--r--src/tools/dcpomatic_server.cc3
-rw-r--r--src/tools/dcpomatic_server_cli.cc5
9 files changed, 30 insertions, 14 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index ede1d4e9b..56f1b5286 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -280,18 +280,10 @@ terminate ()
abort();
}
-/** Call the required functions to set up DCP-o-matic's static arrays, etc.
- * Must be called from the UI thread, if there is one.
- */
void
-dcpomatic_setup ()
+dcpomatic_setup_path_encoding ()
{
#ifdef DCPOMATIC_WINDOWS
- boost::filesystem::path p = g_get_user_config_dir ();
- p /= "backtrace.txt";
- set_backtrace_file (p);
- SetUnhandledExceptionFilter(exception_handler);
-
/* Dark voodoo which, I think, gets boost::filesystem::path to
correctly convert UTF-8 strings to paths, and also paths
back to UTF-8 strings (on path::string()).
@@ -307,6 +299,20 @@ dcpomatic_setup ()
std::locale::global (boost::locale::generator().generate (""));
boost::filesystem::path::imbue (std::locale ());
#endif
+}
+
+/** Call the required functions to set up DCP-o-matic's static arrays, etc.
+ * Must be called from the UI thread, if there is one.
+ */
+void
+dcpomatic_setup ()
+{
+#ifdef DCPOMATIC_WINDOWS
+ boost::filesystem::path p = g_get_user_config_dir ();
+ p /= "backtrace.txt";
+ set_backtrace_file (p);
+ SetUnhandledExceptionFilter(exception_handler);
+#endif
avfilter_register_all ();
diff --git a/src/lib/util.h b/src/lib/util.h
index be21fc89a..95d272979 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -65,6 +65,7 @@ extern std::string seconds_to_hms (int);
extern std::string seconds_to_approximate_hms (int);
extern double seconds (struct timeval);
extern void dcpomatic_setup ();
+extern void dcpomatic_setup_path_encoding ();
extern void dcpomatic_setup_gettext_i18n (std::string);
extern std::string md5_digest_head_tail (std::vector<boost::filesystem::path>, boost::uintmax_t size);
extern void ensure_ui_thread ();
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 6a743baa8..cc85da0ef 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -794,6 +794,8 @@ private:
wxInitAllImageHandlers ();
+ dcpomatic_setup_path_encoding ();
+
/* Enable i18n; this will create a Config object
to look for a force-configured language. This Config
object will be wrong, however, because dcpomatic_setup
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc
index 48ef8f798..8d787dd50 100644
--- a/src/tools/dcpomatic_batch.cc
+++ b/src/tools/dcpomatic_batch.cc
@@ -202,6 +202,8 @@ class App : public wxApp
unsetenv ("UBUNTU_MENUPROXY");
#endif
+ dcpomatic_setup_path_encoding ();
+
/* Enable i18n; this will create a Config object
to look for a force-configured language. This Config
object will be wrong, however, because dcpomatic_setup
diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc
index f885412ef..2659b61bb 100644
--- a/src/tools/dcpomatic_cli.cc
+++ b/src/tools/dcpomatic_cli.cc
@@ -177,6 +177,7 @@ main (int argc, char* argv[])
film_dir = argv[optind];
+ dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
signal_manager = new SignalManager ();
@@ -286,5 +287,3 @@ main (int argc, char* argv[])
return error ? EXIT_FAILURE : EXIT_SUCCESS;
}
-
-
diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc
index 6c479e698..0130b5183 100644
--- a/src/tools/dcpomatic_create.cc
+++ b/src/tools/dcpomatic_create.cc
@@ -81,6 +81,7 @@ public:
int
main (int argc, char* argv[])
{
+ dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
string name;
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 0a43a91f2..6f85f6127 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -216,6 +216,7 @@ int main (int argc, char* argv[])
string const film_dir = argv[optind];
+ dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
shared_ptr<Film> film;
diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc
index 37eeb1e8e..e10fd3138 100644
--- a/src/tools/dcpomatic_server.cc
+++ b/src/tools/dcpomatic_server.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -159,6 +159,7 @@ private:
return false;
}
+ dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
_icon = new TaskBarIcon;
diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc
index efcfdc40e..237673179 100644
--- a/src/tools/dcpomatic_server_cli.cc
+++ b/src/tools/dcpomatic_server_cli.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -59,6 +59,9 @@ help (string n)
int
main (int argc, char* argv[])
{
+ dcpomatic_setup_path_encoding ();
+ dcpomatic_setup ();
+
int num_threads = Config::instance()->num_local_encoding_threads ();
bool verbose = false;
bool write_log = false;