diff --git a/tools/texturev/texturev.cpp b/tools/texturev/texturev.cpp index 40ebd918a..5a26388c8 100644 --- a/tools/texturev/texturev.cpp +++ b/tools/texturev/texturev.cpp @@ -1152,6 +1152,21 @@ void keyBindingHelp(const char* _bindings, const char* _description) ImGui::Text("%s", _description); } +inline std::string replaceAll(const char* _str, const char* _from, const char* _to) +{ + std::string str = _str; + size_t startPos = 0; + const size_t fromLen = bx::strLen(_from); + const size_t toLen = bx::strLen(_to); + while ( (startPos = str.find(_from, startPos) ) != std::string::npos) + { + str.replace(startPos, fromLen, _to); + startPos += toLen; + } + + return str; +} + void associate() { #if BX_PLATFORM_WINDOWS @@ -1160,7 +1175,7 @@ void associate() char exec[bx::kMaxFilePath]; GetModuleFileNameA(GetModuleHandleA(NULL), exec, sizeof(exec) ); - std::string strExec = bx::replaceAll(exec, "\\", "\\\\"); + std::string strExec = replaceAll(exec, "\\", "\\\\"); std::string value; bx::stringPrintf(value, "@=\"\\\"%s\\\" \\\"%%1\\\"\"\r\n\r\n", strExec.c_str() );