fix: Write model name into models.yml when duplicating model (#2224)

* Update model name in the models.yml file (#2214)

* Fix the length of the name.
This commit is contained in:
eshifri
2022-08-26 12:47:53 +10:00
committed by GitHub
parent e97f23a305
commit 4b747caff9
4 changed files with 13 additions and 10 deletions
+7 -4
View File
@@ -208,11 +208,13 @@ ModelsCategory::~ModelsCategory()
}
}
ModelCell * ModelsCategory::addModel(const char * name)
ModelCell * ModelsCategory::addModel(const char * fileName, const char* modelName)
{
if (!name) return NULL;
ModelCell * result = new ModelCell(name);
ModelCell * result = new ModelCell(fileName);
if(modelName)
strncpy(result->modelName, modelName, LEN_MODEL_NAME);
push_back(result);
return result;
}
@@ -508,9 +510,10 @@ ModelsCategory * ModelsList::createCategory(const char* name, bool save)
return result;
}
ModelCell * ModelsList::addModel(ModelsCategory * category, const char * name, bool save)
ModelCell * ModelsList::addModel(ModelsCategory * category, const char * fileName, const char* modelName, bool save)
{
ModelCell * result = category->addModel(name);
ModelCell * result = category->addModel(fileName, modelName);
TRACE("modelName is %s", result->modelName);
modelsCount++;
if (save) this->save();
return result;