Find trust store

This commit is contained in:
Simon Kågedal Reimer 2019-05-11 13:25:58 +02:00
parent dab1963191
commit a0e2298e69
3 changed files with 35 additions and 7 deletions

View File

@ -32,6 +32,10 @@ struct ListDevicesCommand: Command {
print("\(runtime):") print("\(runtime):")
for device in filteredDevices { for device in filteredDevices {
print(" - \(device.name)") print(" - \(device.name)")
let trustStore = TrustStore(uuid: device.udid)
if trustStore.exists {
print(" - Trust store exists at \(trustStore.path)")
}
} }
} }
} }

View File

@ -1,8 +1,17 @@
//
// TrustStore.swift
// XcodeSimulatorKit
//
// Created by Simon Kågedal Reimer on 2019-05-05.
//
import Foundation import Foundation
import Basic
import SQLite
struct TrustStore {
let uuid: String
let path: AbsolutePath
init(uuid: String) {
self.uuid = uuid
self.path = XcodeSimulator.trustStore(forDeviceWithUUID: uuid)
}
var exists: Bool {
return localFileSystem.exists(path)
}
}

View File

@ -1,2 +1,17 @@
import Basic
class XcodeSimulator { class XcodeSimulator {
static let devicesDirectory = localFileSystem.homeDirectory.appending(
RelativePath("Library/Developer/CoreSimulator/Devices")
)
static func directory(forDeviceWithUUID uuid: String) -> AbsolutePath {
return devicesDirectory.appending(component: uuid)
}
static func trustStore(forDeviceWithUUID uuid: String) -> AbsolutePath {
return directory(forDeviceWithUUID: uuid).appending(
RelativePath("data/Library/Keychains/TrustStore.sqlite3")
)
}
} }