From 467b377f3ea1026f0450aaac3b093d3e267c286e Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 2 May 2024 12:27:39 +0200 Subject: Use a named constant length for FileStorage directory names --- src/buildtool/file_system/file_storage.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/buildtool/file_system/file_storage.hpp') diff --git a/src/buildtool/file_system/file_storage.hpp b/src/buildtool/file_system/file_storage.hpp index 178fa7da..fefd22a7 100644 --- a/src/buildtool/file_system/file_storage.hpp +++ b/src/buildtool/file_system/file_storage.hpp @@ -35,6 +35,11 @@ enum class StoreMode { LastWins }; +struct FileStorageData final { + /// Length of a subdirectory name. + static constexpr size_t kDirectoryNameLength = 2; +}; + template std::filesystem::path { - return storage_root_ / id.substr(0, 2) / id.substr(2, id.size() - 2); + return storage_root_ / + id.substr(0, FileStorageData::kDirectoryNameLength) / + id.substr(FileStorageData::kDirectoryNameLength, + id.size() - FileStorageData::kDirectoryNameLength); } [[nodiscard]] auto StorageRoot() const noexcept -- cgit v1.2.3