+static bool
+maybe_load_session ()
+{
+ /* If no session name is given: we're not loading a session yet, nor creating a new one */
+ if (!session_name.length()) {
+ ui->hide_splash ();
+ if (!Config->get_no_new_session_dialog()) {
+ ui->new_session ();
+ }
+
+ return true;
+ }
+
+ /* Load session or start the new session dialog */
+ string name, path;
+
+ bool isnew;
+
+ if (Session::find_session (session_name, path, name, isnew)) {
+ error << string_compose(_("could not load command line session \"%1\""), session_name) << endmsg;
+ return false;
+ }
+
+ if (!new_session) {
+
+ /* Loading a session, but the session doesn't exist */
+ if (isnew) {
+ error << string_compose (_("\n\nNo session named \"%1\" exists.\n"
+ "To create it from the command line, start ardour as \"ardour --new %1"), path)
+ << endmsg;
+ return false;
+ }
+
+ if (ui->load_session (path, name)) {
+ /* it failed */
+ return false;
+ }
+
+ } else {
+
+ /* TODO: This bit of code doesn't work properly yet
+ Glib::signal_idle().connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path));
+ ui->set_will_create_new_session_automatically (true);
+ */
+
+ /* Show the NSD */
+ ui->hide_splash ();
+ if (!Config->get_no_new_session_dialog()) {
+ ui->new_session ();
+ }
+ }
+
+ return true;
+}
+
+#ifdef VST_SUPPORT
+/* this is called from the entry point of a wine-compiled
+ executable that is linked against gtk2_ardour built
+ as a shared library.
+*/
+extern "C" {
+int ardour_main (int argc, char *argv[])
+#else
+int main (int argc, char *argv[])
+#endif
+