From: johanengelen Date: Fri, 30 Mar 2007 22:28:34 +0000 (+0000) Subject: bugfix: escape string parameters on the commandline. For linux, the dollarsign is... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2c235f35ab80a663839f78df5201320f0b3c89c5;p=inkscape.git bugfix: escape string parameters on the commandline. For linux, the dollarsign is escaped aswell. Probably needs to check for other OS'es aswell. On MS Windows, no escaping of dollarsign should be performed. --- diff --git a/src/extension/parameter.cpp b/src/extension/parameter.cpp index 7183b9778..3dc0842ec 100644 --- a/src/extension/parameter.cpp +++ b/src/extension/parameter.cpp @@ -6,7 +6,7 @@ * Author: * Ted Gould * - * Copyright (C) 2006 Johan Engelen + * Copyright (C) 2006-2007 Johan Engelen * Copyright (C) 2005-2006 Author * * Released under GNU GPL, read the file 'COPYING' for more information @@ -16,6 +16,9 @@ # include "config.h" #endif +#ifdef linux +# define ESCAPE_DOLLAR_COMMANDLINE +#endif #include #include @@ -898,10 +901,25 @@ ParamFloat::string (void) Glib::ustring * ParamString::string (void) { + gchar * esc = g_strescape(_value, NULL); + Glib::ustring escaped(esc); + g_free(esc); + +#ifdef ESCAPE_DOLLAR_COMMANDLINE // escape the dollar sign + Glib::ustring::iterator i; + for (i = escaped.begin(); i != escaped.end(); ++i) { + if ( *i == '$') { + i = escaped.insert(i, '\\'); + i++; + } + } +#endif + Glib::ustring * mystring = new Glib::ustring(""); *mystring += "\""; - *mystring += _value; + *mystring += escaped; *mystring += "\""; + return mystring; }