diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-09-28 18:47:16 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-09-28 18:47:34 +0300 |
commit | 10d926cd4aae8b74e0b85d00d899643a0ff113cb (patch) | |
tree | 4665f30e954e8b6348859794096557cbbca90152 | |
parent | 3acf3e9e2ff5bb8a93fcad2df925058d3e7ee748 (diff) |
Cleanup: asset catalogs, move file header definition to constant
Define the standard catalog definition file header in a constant,
separating it from the function that writes the entire file.
No functional changes.
-rw-r--r-- | source/blender/blenkernel/BKE_asset_catalog.hh | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/asset_catalog.cc | 15 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh index cae476708cd..8e6aeec5204 100644 --- a/source/blender/blenkernel/BKE_asset_catalog.hh +++ b/source/blender/blenkernel/BKE_asset_catalog.hh @@ -231,6 +231,7 @@ class AssetCatalogDefinitionFile { * Later versioning code may be added to handle older files. */ const static int SUPPORTED_VERSION; const static std::string VERSION_MARKER; + const static std::string HEADER; CatalogFilePath file_path; diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc index d98d83c477f..e16537fcb7f 100644 --- a/source/blender/blenkernel/intern/asset_catalog.cc +++ b/source/blender/blenkernel/intern/asset_catalog.cc @@ -48,6 +48,13 @@ const int AssetCatalogDefinitionFile::SUPPORTED_VERSION = 1; * that starts with "VERSION". */ const std::string AssetCatalogDefinitionFile::VERSION_MARKER = "VERSION "; +const std::string AssetCatalogDefinitionFile::HEADER = + "# This is an Asset Catalog Definition file for Blender.\n" + "#\n" + "# Empty lines and lines starting with `#` will be ignored.\n" + "# The first non-ignored line should be the version indicator.\n" + "# Other lines are of the format \"UUID:catalog/path/for/assets:simple catalog name\"\n"; + AssetCatalogService::AssetCatalogService(const CatalogFilePath &asset_library_root) : asset_library_root_(asset_library_root) { @@ -652,13 +659,7 @@ bool AssetCatalogDefinitionFile::write_to_disk_unsafe(const CatalogFilePath &des // the file again. // Write the header. - // TODO(@sybren): move the header definition to some other place. - output << "# This is an Asset Catalog Definition file for Blender." << std::endl; - output << "#" << std::endl; - output << "# Empty lines and lines starting with `#` will be ignored." << std::endl; - output << "# The first non-ignored line should be the version indicator." << std::endl; - output << "# Other lines are of the format \"UUID:catalog/path/for/assets:simple catalog name\"" - << std::endl; + output << HEADER; output << "" << std::endl; output << VERSION_MARKER << SUPPORTED_VERSION << std::endl; output << "" << std::endl; |