Changeset View
Changeset View
Standalone View
Standalone View
source/blender/asset_system/intern/asset_catalog_path.cc
- This file was moved from source/blender/blenkernel/intern/asset_catalog_path.cc.
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||||
| /** \file | /** \file | ||||
| * \ingroup bke | * \ingroup asset_system | ||||
| */ | */ | ||||
| #include "BKE_asset_catalog_path.hh" | #include "AS_asset_catalog_path.hh" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| namespace blender::bke { | namespace blender::asset_system { | ||||
| const char AssetCatalogPath::SEPARATOR = '/'; | const char AssetCatalogPath::SEPARATOR = '/'; | ||||
| AssetCatalogPath::AssetCatalogPath(std::string path) : path_(std::move(path)) | AssetCatalogPath::AssetCatalogPath(std::string path) : path_(std::move(path)) | ||||
| { | { | ||||
| } | } | ||||
| AssetCatalogPath::AssetCatalogPath(StringRef path) : path_(path) | AssetCatalogPath::AssetCatalogPath(StringRef path) : path_(path) | ||||
| ▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | AssetCatalogPath AssetCatalogPath::rebase(const AssetCatalogPath &from_path, | ||||
| } | } | ||||
| /* When from_path = "test", we need to skip "test/" to get the rest of the path, hence the +1. */ | /* When from_path = "test", we need to skip "test/" to get the rest of the path, hence the +1. */ | ||||
| const StringRef suffix = StringRef(this->path_).substr(from_path.length() + 1); | const StringRef suffix = StringRef(this->path_).substr(from_path.length() + 1); | ||||
| const AssetCatalogPath path_suffix(suffix); | const AssetCatalogPath path_suffix(suffix); | ||||
| return to_path / path_suffix; | return to_path / path_suffix; | ||||
| } | } | ||||
| } // namespace blender::bke | } // namespace blender::asset_system | ||||