make Session::get_remote_nth_stripable() ignore hidden stripables unless asked.
[ardour.git] / session_utils / common.cc
index 2abfb32d3cb3a1842df3750f67659d112d4e08e0..8d1cdec950d8afb39c3b9c8650701b23ef9b6efb 100644 (file)
@@ -125,18 +125,18 @@ static Session * _load_session (string dir, string state)
        if (Session::get_info_from_path (s, sr, sf) == 0) {
                if (engine->set_sample_rate (sr)) {
                        std::cerr << "Cannot set session's samplerate.\n";
-                       ::exit (EXIT_FAILURE);
+                       return 0;
                }
        } else {
                std::cerr << "Cannot get samplerate from session.\n";
-               ::exit (EXIT_FAILURE);
+               return 0;
        }
 
        init_post_engine ();
 
        if (engine->start () != 0) {
                std::cerr << "Cannot start Audio/MIDI engine\n";
-               ::exit (EXIT_FAILURE);
+               return 0;
        }
 
        Session* session = new Session (*engine, dir, state);
@@ -145,7 +145,7 @@ static Session * _load_session (string dir, string state)
 }
 
 Session *
-SessionUtils::load_session (string dir, string state)
+SessionUtils::load_session (string dir, string state, bool exit_at_failure)
 {
        Session* s = 0;
        try {
@@ -163,6 +163,9 @@ SessionUtils::load_session (string dir, string state)
                cerr << "unknown exception.\n";
                ::exit (EXIT_FAILURE);
        }
+       if (!s && exit_at_failure) {
+               ::exit (EXIT_FAILURE);
+       }
        return s;
 }