mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-28 17:23:47 +00:00
77 → 0 warnings. Split oversized functions and files: controller and agent extension files, standalone RuleSet/ProxySettingsFileStore/ SslocalListenSettings/LegacyImportService, test classes into topic extensions. Regroup activation options into RuntimeDocumentOptions and converter metadata into Provenance. Runtime controller DI seams widen private → internal so the extension files stay cohesive; new controller files are registered in the architecture guard exemption list; Agent target adds RuleSet and SslocalListenSettings to project.yml. Test JSON literals wrap inside the string literal only.
29 lines
982 B
Swift
29 lines
982 B
Swift
import Foundation
|
|
|
|
// MARK: - 进程级路径与环境(测试缝经 SSXNG_* 环境变量覆盖)
|
|
|
|
let environment = ProcessInfo.processInfo.environment
|
|
|
|
let contractURL: URL =
|
|
environment["SSXNG_CONTRACT_PATH"].map { URL(fileURLWithPath: $0) }
|
|
?? RuntimePaths.runtimeFileURL()
|
|
|
|
let sslocalURL: URL =
|
|
environment["SSXNG_SSLOCAL_PATH"].map { URL(fileURLWithPath: $0) }
|
|
?? Bundle.main.bundleURL.appendingPathComponent("Contents/Helpers/sslocal")
|
|
|
|
let runtimeDirectoryOverride: URL? = environment["SSXNG_RUNTIME_DIR"].map {
|
|
URL(fileURLWithPath: $0, isDirectory: true)
|
|
}
|
|
|
|
let aclFileURL: URL =
|
|
runtimeDirectoryOverride?.appendingPathComponent("sslocal-active.acl")
|
|
?? RuntimePaths.aclFileURL()
|
|
|
|
let pidFileURL: URL =
|
|
runtimeDirectoryOverride?.appendingPathComponent("agent.pid") ?? RuntimePaths.agentPIDFileURL()
|
|
|
|
let runtimeStatusFileURL: URL =
|
|
runtimeDirectoryOverride?.appendingPathComponent("agent-runtime-status.json")
|
|
?? RuntimePaths.agentRuntimeStatusURL()
|