Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
1234567891011121314151617181920212223242526import Foundation
func createFixtureBundle(directory: URL, bundleID: String) throws -> URL { guard directory.isFileURL, !bundleID.isEmpty, !bundleID.contains(where: \.isWhitespace) else { throw E2EError(description: "A fixture bundle needs a local directory and a nonempty bundle identifier") } let bundle = directory.appendingPathComponent("Fixture-\(UUID().uuidString).app", isDirectory: true) let contents = bundle.appendingPathComponent("Contents", isDirectory: true) let executables = contents.appendingPathComponent("MacOS", isDirectory: true) try FileManager.default.createDirectory(at: executables, withIntermediateDirectories: true) let executable = executables.appendingPathComponent("FixtureApp") try FileManager.default.copyItem(at: fixtureExecutable(), to: executable) let plist: [String: String] = [ "CFBundleIdentifier": bundleID, "CFBundleExecutable": "FixtureApp", "CFBundleName": "FixtureApp", "CFBundlePackageType": "APPL", "CFBundleVersion": "1", "CFBundleShortVersionString": "1.0", "NSPrincipalClass": "NSApplication", ] let data = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0) try data.write(to: contents.appendingPathComponent("Info.plist"), options: .atomic) return executable}