summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/cross.cc11
-rw-r--r--src/lib/cross.h1
-rw-r--r--src/wx/content_view.cc4
3 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc
index 61b150a3b..b9b215303 100644
--- a/src/lib/cross.cc
+++ b/src/lib/cross.cc
@@ -463,3 +463,14 @@ maybe_open_console ()
}
}
#endif
+
+boost::filesystem::path
+home_directory ()
+{
+#if defined(DCPOMATIC_LINUX) || defined(DCPOMATIC_OSX)
+ return getenv("HOME");
+#endif
+#ifdef DCPOMATIC_WINDOWS
+ return getenv("HOMEDRIVE") / getenv("HOMEPATH");
+#endif
+}
diff --git a/src/lib/cross.h b/src/lib/cross.h
index cd0372338..ee5e7919a 100644
--- a/src/lib/cross.h
+++ b/src/lib/cross.h
@@ -55,6 +55,7 @@ extern void start_batch_converter (boost::filesystem::path dcpomatic);
extern void start_player (boost::filesystem::path dcpomatic);
extern uint64_t thread_id ();
extern int avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags);
+extern boost::filesystem::path home_directory ();
/** @class Waker
* @brief A class which tries to keep the computer awake on various operating systems.
diff --git a/src/wx/content_view.cc b/src/wx/content_view.cc
index 035118245..4db00fb54 100644
--- a/src/wx/content_view.cc
+++ b/src/wx/content_view.cc
@@ -70,8 +70,8 @@ ContentView::update ()
DeleteAllItems ();
_content.clear ();
optional<path> dir = Config::instance()->player_content_directory();
- if (!dir) {
- return;
+ if (!dir || !boost::filesystem::is_directory(*dir)) {
+ dir = home_directory ();
}
wxProgressDialog progress (_("DCP-o-matic"), _("Reading content directory"));