Бранимир Караџић 3 年 前
コミット
eacf36abb0
1 ファイル変更16 行追加1 行削除
  1. 16 1
      tools/texturev/texturev.cpp

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