This commit is contained in:
Branimir Karadžić 2017-07-15 21:21:31 -07:00
parent 3e212b519f
commit 8aa79c43dd

View File

@ -842,13 +842,12 @@ void associate()
bx::stringPrintf(str, "[HKEY_CURRENT_USER\\Software\\Classes\\.%s]\r\n@=\"texturev\"\r\n\r\n", ext); bx::stringPrintf(str, "[HKEY_CURRENT_USER\\Software\\Classes\\.%s]\r\n@=\"texturev\"\r\n\r\n", ext);
} }
char temp[MAX_PATH]; bx::FilePath filePath(bx::TempDir::Tag);
GetTempPathA(MAX_PATH, temp); filePath.join("texture.reg");
bx::strCat(temp, MAX_PATH, "\\texturev.reg");
bx::FileWriter writer; bx::FileWriter writer;
bx::Error err; bx::Error err;
if (bx::open(&writer, temp, false, &err) ) if (bx::open(&writer, filePath, false, &err) )
{ {
bx::write(&writer, str.c_str(), uint32_t(str.length()), &err); bx::write(&writer, str.c_str(), uint32_t(str.length()), &err);
bx::close(&writer); bx::close(&writer);
@ -856,7 +855,7 @@ void associate()
if (err.isOk() ) if (err.isOk() )
{ {
std::string cmd; std::string cmd;
bx::stringPrintf(cmd, "/s %s", temp); bx::stringPrintf(cmd, "/s %s", filePath.get() );
bx::ProcessReader reader; bx::ProcessReader reader;
if (bx::open(&reader, "regedit.exe", cmd.c_str(), &err) ) if (bx::open(&reader, "regedit.exe", cmd.c_str(), &err) )