diff options
Diffstat (limited to 'src/buildtool/file_system/file_storage.hpp')
-rw-r--r-- | src/buildtool/file_system/file_storage.hpp | 10 |
1 files changed, 9 insertions, 1 deletions
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 <ObjectType kType, StoreMode kMode, bool kSetEpochTime, @@ -71,7 +76,10 @@ class FileStorage { /// \returns The sharded file path. [[nodiscard]] auto GetPath(std::string const& id) const noexcept -> 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 |