diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-12-14 20:35:58 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-12-14 20:35:58 +0000 |
| commit | 1b1137dac3167de7e4bb23d86a4f3505ad880675 (patch) | |
| tree | 24c8fcbdfa1e54d006e3e58e588a685697654d5f /src | |
| parent | ac5b373ab1f8d7cbc7b83aa05edec231bc1d956c (diff) | |
swaroop: fall back to home directory if the content directory is not present.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/cross.cc | 11 | ||||
| -rw-r--r-- | src/lib/cross.h | 1 | ||||
| -rw-r--r-- | src/wx/content_view.cc | 4 |
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")); |
