From 07670686f924b1da289396a86dc03af6a3890058 Mon Sep 17 00:00:00 2001 From: jofemodo Date: Fri, 20 Aug 2021 03:31:31 +0200 Subject: [PATCH] Improve internal CLI: Implement tokenization algorithm for command arguments, including double quotes. --- clients/jack_client.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/clients/jack_client.cpp b/clients/jack_client.cpp index 9095c881..4de49455 100644 --- a/clients/jack_client.cpp +++ b/clients/jack_client.cpp @@ -42,6 +42,7 @@ #include #include #include +#include sfz::Sfizz synth; @@ -193,6 +194,30 @@ bool load_instrument(const char *fpath) { } +std::vector string_tokenize(std::string str) { + std::vector tokens; + std::string part = ""; + for (size_t i=0; i "; @@ -202,9 +227,11 @@ void cli_thread_proc() { std::size_t pos = command.find(" "); std::string kw = command.substr(0, pos); std::string args = command.substr(pos+1); + std::vector tokens = string_tokenize(args); if (kw=="load_instrument") { - load_instrument(args.c_str()); + //args.erase(std::remove(str.begin(), str.end(), '\"'), str.end()); + load_instrument(tokens[0].c_str()); } else if (kw=="set_oversampling") { try {