Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
appstore-distribution ▾

xtool.git / Sources / XKit / Utilities / DirectoryProvider.swift

DirectoryProvider.swift18 lines · 530 BRaw
1import Foundation
2import Dependencies
3
4private struct PersistentDirectoryProvider: DependencyKey, Sendable {
5 var directory: URL
6
7 static let liveValue = PersistentDirectoryProvider(
8 directory: URL(fileURLWithPath: NSHomeDirectory())
9 .appendingPathComponent(".config/xtool")
10 )
11}
12
13extension DependencyValues {
14 public var persistentDirectory: URL {
15 get { self[PersistentDirectoryProvider.self].directory }
16 set { self[PersistentDirectoryProvider.self].directory = newValue }
17 }
18}