projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor refinement of new session util
[ardour.git]
/
session_utils
/
new_empty_session.cc
diff --git
a/session_utils/new_empty_session.cc
b/session_utils/new_empty_session.cc
index 21eb6879a2b4813be6fc17199b57b3c5e0f95e8c..6dc0151d0b8f66bab190e54d306607e494ff6307 100644
(file)
--- a/
session_utils/new_empty_session.cc
+++ b/
session_utils/new_empty_session.cc
@@
-2,6
+2,8
@@
#include <cstdlib>
#include <getopt.h>
#include <cstdlib>
#include <getopt.h>
+#include <glibmm.h>
+
#include "common.h"
using namespace std;
#include "common.h"
using namespace std;
@@
-13,19
+15,24
@@
static void usage (int status)
{
// help2man compatible format (standard GNU help-text)
printf (UTILNAME " - create a new empty session from the commandline.\n\n");
{
// help2man compatible format (standard GNU help-text)
printf (UTILNAME " - create a new empty session from the commandline.\n\n");
- printf ("Usage: " UTILNAME " [ OPTIONS ] <session-dir>
<session/snapshot-name>
\n\n");
+ printf ("Usage: " UTILNAME " [ OPTIONS ] <session-dir>
[session-name]
\n\n");
printf ("Options:\n\
-h, --help display this help and exit\n\
-s, --samplerate <rate> samplerate to use (default 48000)\n\
-V, --version print version information and exit\n\
\n");
printf ("Options:\n\
-h, --help display this help and exit\n\
-s, --samplerate <rate> samplerate to use (default 48000)\n\
-V, --version print version information and exit\n\
\n");
+
printf ("\n\
This tool creates a new empty Ardour session.\n\
\n\
printf ("\n\
This tool creates a new empty Ardour session.\n\
\n\
-Note: the tool expects a session-name without .ardour file-name extension.\n\
-\n\
+If the session-name is unspecified, the sesion-dir-name is used.\n\
+If specified, the tool expects a session-name without .ardour\n\
+file-name extension.\n\
+\n");
+
+ printf ("\n\
Examples:\n\
Examples:\n\
-"UTILNAME " -s 44100 /tmp/TestSession TestSession\n\
+"
UTILNAME " -s 44100 /tmp/TestSession TestSession\n\
\n");
printf ("Report bugs to <http://tracker.ardour.org/>\n"
\n");
printf ("Report bugs to <http://tracker.ardour.org/>\n"
@@
-76,21
+83,35
@@
int main (int argc, char* argv[])
}
}
}
}
- // XXX perhaps allow to infer the session-name from the dir-name
- if (optind + 2 > argc) {
+ std::string snapshot_name;
+
+ if (optind + 2 == argc) {
+ snapshot_name = argv[optind+1];
+ } else if (optind + 1 == argc) {
+ snapshot_name = Glib::path_get_basename (argv[optind]);
+ } else {
usage (EXIT_FAILURE);
}
usage (EXIT_FAILURE);
}
+ if (snapshot_name.empty ()) {
+ fprintf(stderr, "Error: Invalid empty session/snapshot name.\n");
+ ::exit (EXIT_FAILURE);
+ }
+
/* all systems go */
SessionUtils::init();
Session* s = 0;
/* all systems go */
SessionUtils::init();
Session* s = 0;
- s = SessionUtils::create_session (argv[optind],
argv[optind+1]
, sample_rate);
+ s = SessionUtils::create_session (argv[optind],
snapshot_name
, sample_rate);
/* save is implicit when creating a new session */
/* save is implicit when creating a new session */
- SessionUtils::unload_session(s);
+ if (s) {
+ std::cout << "Created session in '" << s->path () <<"'" << std::endl;
+ }
+
+ SessionUtils::unload_session (s);
SessionUtils::cleanup();
return 0;
SessionUtils::cleanup();
return 0;