Files
xtool-mirror/Sources/XKit/Utilities/DirectoryProvider.swift
2025-05-06 11:42:55 +05:30

19 lines
530 B
Swift

import Foundation
import Dependencies
private struct PersistentDirectoryProvider: DependencyKey, Sendable {
var directory: URL
static let liveValue = PersistentDirectoryProvider(
directory: URL(fileURLWithPath: NSHomeDirectory())
.appendingPathComponent(".config/xtool")
)
}
extension DependencyValues {
public var persistentDirectory: URL {
get { self[PersistentDirectoryProvider.self].directory }
set { self[PersistentDirectoryProvider.self].directory = newValue }
}
}