summaryrefslogtreecommitdiff
path: root/src/lib/config.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-01-11 00:24:34 +0000
committerCarl Hetherington <cth@carlh.net>2013-01-11 00:24:34 +0000
commitfad726e94700bccdae0d301d54cdb1eab51cc71f (patch)
tree375b2a042acb72f1076415f1c2ac499be1821641 /src/lib/config.cc
parent0b45af42b5a30c3a71d2e1de491843d125e46793 (diff)
Some work on making KDMs in Film
Diffstat (limited to 'src/lib/config.cc')
-rw-r--r--src/lib/config.cc32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 80d357e1a..fe50a5cc2 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -48,7 +48,7 @@ Config::Config ()
, _tms_path (".")
, _sound_processor (SoundProcessor::from_id ("dolby_cp750"))
{
- ifstream f (file().c_str ());
+ ifstream f (read_file().c_str ());
string line;
shared_ptr<Cinema> cinema;
@@ -117,14 +117,40 @@ Config::Config ()
/** @return Filename to write configuration to */
string
-Config::file () const
+Config::write_file () const
{
boost::filesystem::path p;
p /= g_get_user_config_dir ();
+ p /= "dvdomatic";
+ boost::filesystem::create_directory (p);
+ p /= "config";
+ return p.string ();
+}
+
+string
+Config::read_file () const
+{
+ if (boost::filesystem::exists (write_file ())) {
+ return write_file ();
+ }
+
+ boost::filesystem::path p;
+ p /= g_get_user_config_dir ();
p /= ".dvdomatic";
return p.string ();
}
+string
+Config::crypt_chain_directory () const
+{
+ boost::filesystem::path p;
+ p /= g_get_user_config_dir ();
+ p /= "dvdomatic";
+ p /= "crypt";
+ boost::filesystem::create_directories (p);
+ return p.string ();
+}
+
/** @return Singleton instance */
Config *
Config::instance ()
@@ -140,7 +166,7 @@ Config::instance ()
void
Config::write () const
{
- ofstream f (file().c_str ());
+ ofstream f (write_file().c_str ());
f << "num_local_encoding_threads " << _num_local_encoding_threads << "\n"
<< "default_directory " << _default_directory << "\n"
<< "server_port " << _server_port << "\n"