write garbage

- fix PathManager nullptr assign issue
- fix Context set encoding unexpected copy issue
- write some export function for BMap.
This commit is contained in:
2023-09-23 16:25:26 +08:00
parent 94dadbfb1f
commit a17b9deb4c
7 changed files with 81 additions and 15 deletions

View File

@ -22,6 +22,8 @@ namespace LibCmo::CK2::MgrImpls {
CKPathManager::~CKPathManager() {}
bool CKPathManager::SetTempFolder(CKSTRING u8_temp) {
if (u8_temp == nullptr) return false;
std::filesystem::path cache;
EncodingHelper::U8PathToStdPath(cache, u8_temp);
if (std::filesystem::is_directory(cache)) {
@ -39,6 +41,8 @@ namespace LibCmo::CK2::MgrImpls {
}
XContainer::XString CKPathManager::GetTempFilePath(CKSTRING u8_filename) {
if (u8_filename == nullptr) return XContainer::XString();
std::filesystem::path stdfilename;
EncodingHelper::U8PathToStdPath(stdfilename, u8_filename);
auto realfile = this->m_TempFolder / stdfilename;
@ -50,6 +54,7 @@ namespace LibCmo::CK2::MgrImpls {
bool CKPathManager::AddPath(CKSTRING u8path) {
if (u8path == nullptr) return false;
std::filesystem::path newpath;
EncodingHelper::U8PathToStdPath(newpath, u8path);
if (std::filesystem::is_directory(newpath)) {