Allow tpt.beginGetScript to overwrite existing files unconditionally

It's not worth the trouble to ask questions (this was the old behaviour), the next best thing (in terms of preserving old behaviour) is to overwrite unconditionally. There is no situation in which the file name would be specified but the user wouldn't want the file to be written to.
This commit is contained in:
Tamás Bálint Misius
2023-12-20 19:13:37 +01:00
parent e20312a672
commit 95b83ffd61

View File

@@ -4761,11 +4761,6 @@ void LuaScriptInterface::OnTick()
complete({ GetScriptStatus::GetFailed{ ByteString(http::StatusText(ret)).FromUtf8() } }); complete({ GetScriptStatus::GetFailed{ ByteString(http::StatusText(ret)).FromUtf8() } });
return; return;
} }
if (Platform::FileExists(scriptDownloadFilename))
{
complete({ GetScriptStatus::GetFailed{ "File already exists" } });
return;
}
if (!Platform::WriteFile(std::vector<char>(scriptData.begin(), scriptData.end()), scriptDownloadFilename)) if (!Platform::WriteFile(std::vector<char>(scriptData.begin(), scriptData.end()), scriptDownloadFilename))
{ {
complete({ GetScriptStatus::GetFailed{ "Unable to write to file" } }); complete({ GetScriptStatus::GetFailed{ "Unable to write to file" } });