summaryrefslogtreecommitdiffstats
path: root/src/extension/parameter.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-03-30 22:28:34 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-03-30 22:28:34 +0000
commit1389d6b2d7e1c345244a311bb03df0052e61f2af (patch)
tree8c9fd780a605b94c7568d539152f1e873f558e68 /src/extension/parameter.cpp
parentadd a snappoint at the rotation-axis of any shape (diff)
downloadinkscape-1389d6b2d7e1c345244a311bb03df0052e61f2af.tar.gz
inkscape-1389d6b2d7e1c345244a311bb03df0052e61f2af.zip
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.
(bzr r2789)
Diffstat (limited to 'src/extension/parameter.cpp')
-rw-r--r--src/extension/parameter.cpp22
1 files changed, 20 insertions, 2 deletions
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 <ted@gould.cx>
*
- * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2006-2007 Johan Engelen <johan@shouraizou.nl>
* 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 <gtkmm/adjustment.h>
#include <gtkmm/box.h>
@@ -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;
}