Some checks are pending
Build AppImage / Build AppImage (push) Waiting to run
Build Apple Apps / Build App (iOS) (push) Waiting to run
Build Apple Apps / Build App (iOS Simulator) (push) Waiting to run
Build Apple Apps / Build App (macOS) (push) Waiting to run
Build Docker / Build Docker Image (push) Waiting to run
Build Rust Crate / Build Crate (macOS (Intel)) (push) Waiting to run
Build Rust Crate / Build Crate (macOS) (push) Waiting to run
Build Rust Crate / Build Crate (Linux) (push) Waiting to run
Build Rust Crate / Build Crate (Windows) (push) Waiting to run
38 lines
1.2 KiB
Swift
38 lines
1.2 KiB
Swift
@_implementationOnly import CConstants
|
|
import OSLog
|
|
|
|
public enum Constants {
|
|
enum Error: Swift.Error {
|
|
case invalidAppGroupIdentifier
|
|
}
|
|
|
|
public static let bundleIdentifier = AppBundleIdentifier
|
|
public static let appGroupIdentifier = AppGroupIdentifier
|
|
public static let networkExtensionBundleIdentifier = NetworkExtensionBundleIdentifier
|
|
|
|
public static var socketURL: URL {
|
|
get throws {
|
|
try groupContainerURL.appending(component: "burrow.sock", directoryHint: .notDirectory)
|
|
}
|
|
}
|
|
public static var databaseURL: URL {
|
|
get throws {
|
|
try groupContainerURL.appending(component: "burrow.db", directoryHint: .notDirectory)
|
|
}
|
|
}
|
|
|
|
private static var groupContainerURL: URL {
|
|
get throws { try _groupContainerURL.get() }
|
|
}
|
|
private static let _groupContainerURL: Result<URL, Error> = {
|
|
switch FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier) {
|
|
case .some(let url): .success(url)
|
|
case .none: .failure(.invalidAppGroupIdentifier)
|
|
}
|
|
}()
|
|
}
|
|
|
|
extension Logger {
|
|
@_dynamicReplacement(for: subsystem)
|
|
public static var subsystem: String { Constants.bundleIdentifier }
|
|
}
|