| 407 | } |
| 408 | |
| 409 | std::string ModelPackageImpl::addItem(const std::filesystem::path& path, const std::string& name, const std::string& author, const std::string& description) |
| 410 | { |
| 411 | if (findItem(name, author) != nullptr) { |
| 412 | throw std::runtime_error("The package already contains a file with name: " + name + " author: " + author); |
| 413 | } |
| 414 | |
| 415 | auto filePath = getItemPath(name, author); |
| 416 | auto dstPath = m_packageDataDirPath / filePath; |
| 417 | |
| 418 | create_directories(dstPath.parent_path()); |
| 419 | std::filesystem::copy(path, dstPath); |
| 420 | |
| 421 | auto identifier = generateIdentifier(); |
| 422 | createItemInfoEntry(identifier, filePath.string(), name, author, description); |
| 423 | return identifier; |
| 424 | } |
| 425 | |
| 426 | std::string ModelPackageImpl::setRootModel(const std::filesystem::path& path, const std::string& name, const std::string& author, const std::string& description) |
| 427 | { |