1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Fix - Nyquist v4 path strings needed to be escaped for Windows.

This commit is contained in:
stevethefiddle@gmail.com 2014-12-01 18:31:33 +00:00
parent 2acdcc3378
commit 6c781a6a1d
2 changed files with 17 additions and 11 deletions

View File

@ -493,16 +493,16 @@ bool EffectNyquist::Process()
mProps += wxString::Format(wxT("(putprop '*AUDACITY* (list %d %d %d) 'VERSION)\n"), AUDACITY_VERSION, AUDACITY_RELEASE, AUDACITY_REVISION);
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'BASE)\n"), FileNames::BaseDir().c_str());
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'DATA)\n"), FileNames::DataDir().c_str());
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'HELP)\n"), FileNames::HtmlHelpDir().RemoveLast().c_str());
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'TEMP)\n"), FileNames::TempDir().c_str());
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'BASE)\n"), EscapeString(FileNames::BaseDir()).c_str());
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'DATA)\n"), EscapeString(FileNames::DataDir()).c_str());
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'HELP)\n"), EscapeString(FileNames::HtmlHelpDir().RemoveLast()).c_str());
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* \"%s\" 'TEMP)\n"), EscapeString(FileNames::TempDir()).c_str());
wxArrayString paths = EffectNyquist::GetNyquistSearchPath();
wxString list;
for (size_t i = 0, cnt = paths.GetCount(); i < cnt; i++)
{
list += wxT("\"") + paths[i] + wxT("\" ");
list += wxT("\"") + EscapeString(paths[i]) + wxT("\" ");
}
mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* (list %s) 'PLUGIN)\n"), list.RemoveLast().c_str());
@ -845,22 +845,18 @@ bool EffectNyquist::ProcessOne()
(int)(mControls[j].val));
}
else if (mControls[j].type == NYQ_CTRL_STRING) {
wxString str = mControls[j].valStr;
str.Replace(wxT("\\"), wxT("\\\\"));
str.Replace(wxT("\""), wxT("\\\""));
cmd += wxT("(setf ");
// restrict variable names to 7-bit ASCII:
cmd += mControls[j].var.c_str();
cmd += wxT(" \"");
cmd += str; // unrestricted value will become quoted UTF-8
cmd += EscapeString(mControls[j].valStr); // unrestricted value will become quoted UTF-8
cmd += wxT("\")\n");
}
}
if (mIsSal) {
wxString str = mCmd;
str.Replace(wxT("\\"), wxT("\\\\"));
str.Replace(wxT("\""), wxT("\\\""));
EscapeString(str);
// this is tricky: we need SAL to call main so that we can get a
// SAL traceback in the event of an error (sal-compile catches the
// error and calls sal-error-output), but SAL does not return values.
@ -1074,6 +1070,15 @@ wxString EffectNyquist::NyquistToWxString(const char *nyqString)
return str;
}
wxString EffectNyquist::EscapeString(const wxString & inStr)
{
wxString str = inStr;
str.Replace(wxT("\\"), wxT("\\\\"));
str.Replace(wxT("\""), wxT("\\\""));
return str;
}
void EffectNyquist::Break()
{

View File

@ -153,6 +153,7 @@ class AUDACITY_DLL_API EffectNyquist:public Effect
private:
static wxString NyquistToWxString(const char *nyqString);
wxString EscapeString(const wxString & inStr);
bool ProcessOne();