1pub use encoding_rs::WINDOWS_1252;
2
3pub use game_storage::DiscoverMode;
4pub use game_storage::GameStorage;
5pub use game_storage::OnlineProfileInfo;
6
7pub use errors::{HybridStorageError, OnlineStorageError};
8pub use events::SnapshotEvent;
9
10#[cfg(feature = "online")]
11pub use game_storage::{
12 AccountDto, AuthInfo, AuthPoll, RoomDto, RoomIdentity, RoomRecordDto, RoomSummaryDto,
13 RoomUploadResult, high_times_entries_from_records, http_get_bytes, http_get_bytes_opt,
14 http_post_bytes,
15};
16
17mod errors;
18mod events;
19mod game_storage;
21
22#[cfg(feature = "online")]
29pub mod rooms {
30 pub use crate::game_storage::{
31 RoomDto, RoomIdentity, RoomRecordDto, RoomSummaryDto, RoomUploadResult,
32 high_times_entries_from_records, room_remove_payload,
33 };
34}
35
36#[cfg(feature = "online")]
41pub mod auth {
42 pub use crate::game_storage::{AccountDto, AuthInfo, AuthPoll};
43}
44
45#[derive(PartialEq, Clone, Copy, Debug)]
46pub enum AssetType {
47 Content,
48 Profile,
49}
50
51#[must_use]
53pub fn get_repository_path(root_path: &std::path::Path) -> std::path::PathBuf {
54 root_path.join(".supreme")
55}
56
57#[must_use]
59pub fn get_contents_path(root_path: &std::path::Path) -> std::path::PathBuf {
60 get_repository_path(root_path).join("contents")
61}
62
63#[must_use]
65pub fn get_profiles_path(root_path: &std::path::Path) -> std::path::PathBuf {
66 get_repository_path(root_path).join("profiles")
67}
68
69#[cfg(test)]
70mod tests {
71 use super::*;
72 use std::path::Path;
73
74 #[test]
75 fn repository_path_is_dot_supreme_under_root() {
76 let root = Path::new("/games/my_game");
77 assert_eq!(
78 get_repository_path(root),
79 Path::new("/games/my_game/.supreme")
80 );
81 }
82
83 #[test]
84 fn contents_path_is_nested_under_repository_path() {
85 let root = Path::new("/games/my_game");
86 assert_eq!(
87 get_contents_path(root),
88 Path::new("/games/my_game/.supreme/contents")
89 );
90 }
91
92 #[test]
93 fn profiles_path_is_nested_under_repository_path() {
94 let root = Path::new("/games/my_game");
95 assert_eq!(
96 get_profiles_path(root),
97 Path::new("/games/my_game/.supreme/profiles")
98 );
99 }
100
101 #[test]
102 fn asset_type_supports_equality() {
103 assert_eq!(AssetType::Content, AssetType::Content);
104 assert_ne!(AssetType::Content, AssetType::Profile);
105 }
106}