[beast: 13/19] BSE: bsetool: add 'check-load' command to test BSE file validity
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 13/19] BSE: bsetool: add 'check-load' command to test BSE file validity
- Date: Sun, 13 Sep 2015 20:27:12 +0000 (UTC)
commit dae2a392ceae98ae8b12cee6e75ccac448d51784
Author: Tim Janik <timj gnu org>
Date: Wed Sep 9 10:36:56 2015 +0200
BSE: bsetool: add 'check-load' command to test BSE file validity
bse/bsetool.cc | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/bse/bsetool.cc b/bse/bsetool.cc
index 517a246..cc349aa 100644
--- a/bse/bsetool.cc
+++ b/bse/bsetool.cc
@@ -156,6 +156,24 @@ render2wav (const ArgParser &ap)
return ERROR_NONE;
}
+// == check-load ==
+static ArgDescription check_load_options[] = {
+ { "<bse-file>", "", "The BSE file to load and check for validity", "" },
+};
+
+static String
+check_load (const ArgParser &ap)
+{
+ const String bsefile = ap["bse-file"];
+ auto project = BSE_SERVER.create_project (bsefile);
+ project->auto_deactivate (0);
+ auto err = project->restore_from_file (bsefile);
+ if (err)
+ return string_format ("%s: loading failed: %s", bsefile, bse_error_blurb (err));
+ // success
+ return "";
+}
+
// == bse tool ==
static ArgDescription bsetool_options[] = {
{ "--bse-no-load", "", "Prevent automated plugin and script registration", "" },
@@ -205,6 +223,23 @@ main (int argc, char *argv[])
}
return 0; // success
}
+ else if (option_argc < argc && argv[option_argc] == String ("check-load"))
+ {
+ ArgParser ap (check_load_options);
+ String error = ap.parse_args (argc - option_argc - 1, argv + option_argc + 1);
+ if (!error.empty())
+ {
+ printerr ("%s: check-load: %s\n", argv[0], error);
+ return 127;
+ }
+ error = check_load (ap);
+ if (!error.empty())
+ {
+ printerr ("check-load: %s\n", error);
+ return 127;
+ }
+ return 0; // success
+ }
else
{
printerr ("%s: %s\n", argv[0], "missing command");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]