tv-anarchy/Sources/TVAnarchyCore/StatePaths.swift

18 lines
759 B
Swift

import Foundation
/// The single home for the app's local state directory. Everything under
/// `~/.local/state/tv-anarchy/` (library snapshot, metadata sidecars, settings)
/// resolves through here so the resources-drive asset sync has exactly one tree to
/// push/pull no store gets to invent its own path.
public enum StatePaths {
/// Root of the app's local state: `~/.local/state/tv-anarchy`.
public static var root: URL {
FileManager.default.homeDirectoryForCurrentUser
.appendingPathComponent(".local/state/tv-anarchy")
}
/// A path under the state root, e.g. `url("library.json")` or `url("meta")`.
public static func url(_ relative: String) -> URL {
root.appendingPathComponent(relative)
}
}