mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-02 19:50:10 +08:00
50 lines
1.3 KiB
Swift
50 lines
1.3 KiB
Swift
import Foundation
|
|
import UniformTypeIdentifiers
|
|
|
|
public struct VBVirtualMachine: Identifiable, Hashable {
|
|
public var id: String { bundleURL.absoluteString }
|
|
public let bundleURL: URL
|
|
public var name: String { bundleURL.deletingPathExtension().lastPathComponent }
|
|
public internal(set) var NVRAM = [VBNVRAMVariable]()
|
|
}
|
|
|
|
public extension VBVirtualMachine {
|
|
static let bundleExtension = "vbvm"
|
|
}
|
|
|
|
public extension VBVirtualMachine {
|
|
static let preview = VBVirtualMachine(bundleURL: URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("Sample.vbvm"))
|
|
}
|
|
|
|
extension VBVirtualMachine {
|
|
|
|
var diskImagePath: String {
|
|
bundleURL.appendingPathComponent("Disk.img").path
|
|
}
|
|
|
|
var extraDiskImagePath: String {
|
|
bundleURL.appendingPathComponent("Disk2.img").path
|
|
}
|
|
|
|
var auxiliaryStorageURL: URL {
|
|
bundleURL.appendingPathComponent("AuxiliaryStorage")
|
|
}
|
|
|
|
var machineIdentifierURL: URL {
|
|
bundleURL.appendingPathComponent("MachineIdentifier")
|
|
}
|
|
|
|
var hardwareModelURL: URL {
|
|
bundleURL.appendingPathComponent("HardwareModel")
|
|
}
|
|
|
|
var metadataDirectoryURL: URL {
|
|
bundleURL.appendingPathComponent(".vbdata")
|
|
}
|
|
|
|
}
|
|
|
|
public extension UTType {
|
|
static let virtualBuddyVM = UTType(exportedAs: "codes.rambo.VirtualBuddy.VM", conformingTo: .bundle)
|
|
}
|