This commit is contained in:
Бранимир Караџић
2022-09-01 23:33:24 -07:00
parent 4613bd1e02
commit eacf36abb0

View File

@@ -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<std::string>(exec, "\\", "\\\\");
std::string strExec = replaceAll(exec, "\\", "\\\\");
std::string value;
bx::stringPrintf(value, "@=\"\\\"%s\\\" \\\"%%1\\\"\"\r\n\r\n", strExec.c_str() );