From c532c68ddeade1a73178b923d4dbe8783b66fcfc Mon Sep 17 00:00:00 2001 From: Aloshi Date: Sat, 1 Nov 2014 12:56:32 -0500 Subject: [PATCH] Fix multiple occurances of tags in launch commands not being replaced. --- es-app/src/SystemData.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index 50889da91..d506d0f9f 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -61,14 +61,13 @@ SystemData::~SystemData() delete mRootFolder; } -std::string strreplace(std::string& str, std::string replace, std::string with) +std::string strreplace(std::string str, const std::string& replace, const std::string& with) { - size_t pos = str.find(replace); - - if(pos != std::string::npos) - return str.replace(pos, replace.length(), with.c_str(), with.length()); - else - return str; + size_t pos; + while((pos = str.find(replace)) != std::string::npos) + str = str.replace(pos, replace.length(), with.c_str(), with.length()); + + return str; } std::string escapePath(const boost::filesystem::path& path)