fix saving issue

- fix CKStateChunk resize memory error.
- fix wrong CKBitmapHandler free position in CKBitmapData writer.
- fix init value error of CKFileWriter::m_DisableAddingFile when copying from reader.
- fix ReadString, WriteString error in CKStateChunk (forget NULL terminal)
- change CKPathManager resolve path order. Resolve temp path first, then resources folder.
- fix mixdata combine error when writing CKTexture.
This commit is contained in:
2023-09-30 16:01:39 +08:00
parent abea66d6f0
commit ee4b621cac
10 changed files with 62 additions and 36 deletions

View File

@ -78,6 +78,13 @@ namespace LibCmo::CK2::MgrImpls {
return true;
}
// test in temp folder
auto tempfile = m_TempFolder / filepath;
if (std::filesystem::is_regular_file(tempfile)) {
EncodingHelper::StdPathToU8Path(u8_filename, tempfile);
return true;
}
// otherwise check it in extra path
for (const auto& extrapath : m_ExtraPathes) {
auto combinedpath = extrapath / filepath;
@ -88,13 +95,6 @@ namespace LibCmo::CK2::MgrImpls {
}
}
// test in temp folder
auto tempfile = m_TempFolder / filepath;
if (std::filesystem::is_regular_file(tempfile)) {
EncodingHelper::StdPathToU8Path(u8_filename, tempfile);
return true;
}
// failed
return false;
}

View File

@ -47,8 +47,8 @@ namespace LibCmo::CK2::MgrImpls {
* @remark
* We match file in following order.
* + Whether given file is absolute path. return if true.
* + User provided extra path.
* + Virtools temp folder.
* + User provided extra path.
* @return true if success
*/
bool ResolveFileName(XContainer::XString& u8_filename);