mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
slightly improved windows post-export hook support.
This commit is contained in:
parent
73245c6217
commit
d442190b8a
1 changed files with 24 additions and 5 deletions
|
|
@ -201,12 +201,27 @@ SystemExec::SystemExec (std::string command, const std::map<char, std::string> s
|
||||||
make_argp_escaped(command, subs);
|
make_argp_escaped(command, subs);
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
std::string wa;
|
if (argp[0] && strlen (argp[0]) > 0) {
|
||||||
for (int i = 0; argp[i]; ++i) {
|
std::string wa = argp[0];
|
||||||
if (!wa.empty ()) wa += " ";
|
// only add quotes to command if required..
|
||||||
wa += '"' + argp[i] + '"';
|
if (argp[0][0] != '"'
|
||||||
|
&& argp[0][strlen(argp[0])-1] != '"'
|
||||||
|
&& strchr(argp[0], ' ')) {
|
||||||
|
wa = "\"";
|
||||||
|
wa += argp[0];
|
||||||
|
wa += "\"";
|
||||||
|
}
|
||||||
|
// ...but always quote all args
|
||||||
|
for (int i = 1; argp[i]; ++i) {
|
||||||
|
std::string tmp (argp[i]);
|
||||||
|
while (tmp.find("\"") != std::string::npos)
|
||||||
|
tmp.replace(s.find("\""), 1, "\\\"");
|
||||||
|
wa += " \"";
|
||||||
|
wa += tmp
|
||||||
|
wa += '"';
|
||||||
}
|
}
|
||||||
w_args = strdup(wa.c_str());
|
w_args = strdup(wa.c_str());
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (find_file (Searchpath (Glib::getenv ("PATH")), argp[0], cmd)) {
|
if (find_file (Searchpath (Glib::getenv ("PATH")), argp[0], cmd)) {
|
||||||
// argp[0] exists in $PATH` - set it to the actual path where it was found
|
// argp[0] exists in $PATH` - set it to the actual path where it was found
|
||||||
|
|
@ -323,6 +338,9 @@ interposer_thread (void *arg) {
|
||||||
string
|
string
|
||||||
SystemExec::to_s () const
|
SystemExec::to_s () const
|
||||||
{
|
{
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
return string (w_args ? w_args :: "");
|
||||||
|
#else
|
||||||
stringstream out;
|
stringstream out;
|
||||||
if (argp) {
|
if (argp) {
|
||||||
for (int i = 0; argp[i]; ++i) {
|
for (int i = 0; argp[i]; ++i) {
|
||||||
|
|
@ -330,6 +348,7 @@ SystemExec::to_s () const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out.str();
|
return out.str();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS /* Windows Process */
|
#ifdef PLATFORM_WINDOWS /* Windows Process */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue