aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-05-29 14:37:53 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-01-15 11:47:26 +0000
commit9a5b5ee81f15b1d89cb25ff3e137a672536cdc46 (patch)
tree2ad92d33d68988a6c57e621ae5431fe88dd6ba5e /src/util
parent6196e930018181301b5972842ae384ea4288ff34 (diff)
wallet: Replace %w by wallet name in -walletnotify script
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/system.cpp10
-rw-r--r--src/util/system.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 8d1efc170a..2e58f35512 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -63,6 +63,7 @@
#include <malloc.h>
#endif
+#include <boost/algorithm/string/replace.hpp>
#include <thread>
#include <typeinfo>
#include <univalue.h>
@@ -1022,6 +1023,15 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
}
#endif
+#ifndef WIN32
+std::string ShellEscape(const std::string& arg)
+{
+ std::string escaped = arg;
+ boost::replace_all(escaped, "'", "'\"'\"'");
+ return "'" + escaped + "'";
+}
+#endif
+
#if HAVE_SYSTEM
void runCommand(const std::string& strCommand)
{
diff --git a/src/util/system.h b/src/util/system.h
index 394adb9555..c3424e7da7 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -81,6 +81,9 @@ fs::path GetConfigFile(const std::string& confPath);
#ifdef WIN32
fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
#endif
+#ifndef WIN32
+std::string ShellEscape(const std::string& arg);
+#endif
#if HAVE_SYSTEM
void runCommand(const std::string& strCommand);
#endif