Merge pull request #42571 from akien-mga/fix-binary-format-load-error

Improve format version mismatch error in binary loader
This commit is contained in:
Rémi Verschelde 2020-10-05 20:30:24 +02:00 committed by GitHub
commit 437a9393b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -863,7 +863,8 @@ void ResourceLoaderBinary::open(FileAccess *p_f) {
if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) { if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
f->close(); f->close();
ERR_FAIL_MSG("File format '" + itos(FORMAT_VERSION) + "." + itos(ver_major) + "." + itos(ver_minor) + "' is too new! Please upgrade to a new engine version: " + local_path + "."); ERR_FAIL_MSG(vformat("File '%s' can't be loaded, as it uses a format version (%d) or engine version (%d.%d) which are not supported by your engine version (%s).",
local_path, ver_format, ver_major, ver_minor, VERSION_BRANCH));
} }
type = get_unicode_string(); type = get_unicode_string();
@ -1136,7 +1137,9 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) { if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
memdelete(f); memdelete(f);
memdelete(fw); memdelete(fw);
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "File format '" + itos(FORMAT_VERSION) + "." + itos(ver_major) + "." + itos(ver_minor) + "' is too new! Please upgrade to a new engine version: " + local_path + "."); ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED,
vformat("File '%s' can't be loaded, as it uses a format version (%d) or engine version (%d.%d) which are not supported by your engine version (%s).",
local_path, ver_format, ver_major, ver_minor, VERSION_BRANCH));
} }
// Since we're not actually converting the file contents, leave the version // Since we're not actually converting the file contents, leave the version