mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-21 22:44:31 +00:00
18 lines
690 B
Swift
18 lines
690 B
Swift
import Foundation
|
|
|
|
/// Resolves the on-disk directory shared by the CLI, desktop app and menubar.
|
|
enum CodeBurnCacheDirectory {
|
|
static func resolve(
|
|
environment: [String: String] = ProcessInfo.processInfo.environment,
|
|
homeDirectory: URL = FileManager.default.homeDirectoryForCurrentUser
|
|
) -> String {
|
|
if let override = environment["CODEBURN_CACHE_DIR"],
|
|
!override.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
|
return override
|
|
}
|
|
return homeDirectory
|
|
.appendingPathComponent(".cache", isDirectory: true)
|
|
.appendingPathComponent("codeburn", isDirectory: true)
|
|
.path
|
|
}
|
|
}
|