diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-10-25 13:36:47 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-10-25 13:37:35 +0300 |
commit | 892e5f4a9f8a3f4e67a6ff00e4195b628decc127 (patch) | |
tree | 737e29b1991e8a0919f1cc0a4b5ae98d6130b9f2 /source/blender/editors/asset/intern | |
parent | 550cbec5c4dcf785d382950e2651a423f55b2f6a (diff) |
Asset Catalogs: be more accepting of backslashes as separators
Asset Catalog Paths should only contain forward slashes as separators, but
now the UI is more resilient to people using blackslashes instead.
Manifest Task: T90553
Diffstat (limited to 'source/blender/editors/asset/intern')
-rw-r--r-- | source/blender/editors/asset/intern/asset_catalog.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/asset/intern/asset_catalog.cc b/source/blender/editors/asset/intern/asset_catalog.cc index dae960cbb0a..f3ba12a6324 100644 --- a/source/blender/editors/asset/intern/asset_catalog.cc +++ b/source/blender/editors/asset/intern/asset_catalog.cc @@ -107,17 +107,17 @@ void ED_asset_catalog_rename(::AssetLibrary *library, AssetCatalog *catalog = catalog_service->find_catalog(catalog_id); - AssetCatalogPath new_path = catalog->path.parent(); - new_path = new_path / StringRef(new_name); + const AssetCatalogPath new_path = catalog->path.parent() / StringRef(new_name); + const AssetCatalogPath clean_new_path = new_path.cleanup(); - if (new_path == catalog->path) { + if (new_path == catalog->path || clean_new_path == catalog->path) { /* Nothing changed, so don't bother renaming for nothing. */ return; } catalog_service->undo_push(); catalog_service->tag_has_unsaved_changes(catalog); - catalog_service->update_catalog_path(catalog_id, new_path); + catalog_service->update_catalog_path(catalog_id, clean_new_path); WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr); } |