mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-18 09:14:48 -04:00
+1
-1
@@ -33,7 +33,7 @@ public:
|
||||
std::vector<ResourceId> GetHeaderId() const;
|
||||
int64_t GetId(ResType resType, const std::string &name) const;
|
||||
int64_t GetSystemId(ResType resType, const std::string &name) const;
|
||||
void LoadIdFromHap(const std::map<int64_t, std::vector<ResourceItem>> &items);
|
||||
int64_t LoadIdFromHap(const std::map<int64_t, std::vector<ResourceItem>> &items);
|
||||
|
||||
private:
|
||||
int64_t GenerateAppId(ResType resType, const std::string &name);
|
||||
|
||||
+7
-2
@@ -84,7 +84,7 @@ int64_t IdWorker::GetSystemId(ResType resType, const string &name) const
|
||||
return result->second.id;
|
||||
}
|
||||
|
||||
void IdWorker::LoadIdFromHap(const map<int64_t, vector<ResourceItem>> &items)
|
||||
int64_t IdWorker::LoadIdFromHap(const map<int64_t, vector<ResourceItem>> &items)
|
||||
{
|
||||
int64_t minId = 0xffffffff;
|
||||
int64_t maxId = 0x01000000;
|
||||
@@ -96,7 +96,12 @@ void IdWorker::LoadIdFromHap(const map<int64_t, vector<ResourceItem>> &items)
|
||||
maxId = max(maxId, item.first);
|
||||
}
|
||||
maxId_ = GetMaxId(minId);
|
||||
appId_ = maxId + 1;
|
||||
if (static_cast<uint64_t>(maxId) > maxId_) {
|
||||
PrintError(GetError(ERR_CODE_RESOURCE_ID_EXCEED).FormatCause(static_cast<uint64_t>(maxId), maxId_));
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
appId_ = static_cast<uint64_t>(maxId) + 1;
|
||||
return RESTOOL_SUCCESS;
|
||||
}
|
||||
|
||||
int64_t IdWorker::GenerateAppId(ResType resType, const string &name)
|
||||
|
||||
@@ -88,7 +88,9 @@ uint32_t ResourceOverlap::LoadHapResources()
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
|
||||
IdWorker::GetInstance().LoadIdFromHap(items);
|
||||
if (IdWorker::GetInstance().LoadIdFromHap(items) != RESTOOL_SUCCESS) {
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
|
||||
FileManager &fileManager = FileManager::GetInstance();
|
||||
fileManager.SetModuleName(moduleName_);
|
||||
|
||||
@@ -47,7 +47,11 @@ uint32_t ResourcePack::Package()
|
||||
}
|
||||
unique_ptr<ResourcePack> resourcePacker =
|
||||
ResourcePackerFactory::CreatePacker(packType_, packageParser_);
|
||||
errorCode = resourcePacker->Pack();
|
||||
if (!resourcePacker) {
|
||||
errorCode = RESTOOL_ERROR;
|
||||
} else {
|
||||
errorCode = resourcePacker->Pack();
|
||||
}
|
||||
}
|
||||
if (errorCode == RESTOOL_SUCCESS) {
|
||||
ShowPackSuccess();
|
||||
|
||||
Reference in New Issue
Block a user