-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full rewrite using appkit instead of swift ui
now supports installing multiple vms
- Loading branch information
*
committed
Oct 12, 2024
1 parent
080c419
commit 19e12c1
Showing
54 changed files
with
3,123 additions
and
2,234 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
virtualOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
xcuserstate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// AppDelegate.swift | ||
// virtualOS | ||
// | ||
// Created by Jahn Bertsch. | ||
// | ||
|
||
import Cocoa | ||
|
||
@main | ||
final class AppDelegate: NSObject, NSApplicationDelegate { | ||
func applicationDidFinishLaunching(_ aNotification: Notification) { | ||
// Insert code here to initialize your application | ||
} | ||
|
||
func applicationWillTerminate(_ aNotification: Notification) { | ||
// Insert code here to tear down your application | ||
} | ||
|
||
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { | ||
return true | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// OsVersion.swift | ||
// virtualOS | ||
// | ||
// Created by Jahn Bertsch | ||
// | ||
|
||
import Virtualization | ||
|
||
#if arch(arm64) | ||
|
||
extension VZMacOSRestoreImage { | ||
var operatingSystemVersionString: String { | ||
return "macOS \(operatingSystemVersion.majorVersion).\(operatingSystemVersion.minorVersion).\(operatingSystemVersion.patchVersion) (Build \(buildVersion))" | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Bundle.swift | ||
// virtualOS | ||
// | ||
// Created by Jahn Bertsch. | ||
// | ||
|
||
import Foundation | ||
|
||
struct VMBundle: Identifiable, Hashable { | ||
var id: String { | ||
return url.absoluteString | ||
} | ||
var url: URL | ||
var name: String { | ||
return url.lastPathComponent.replacingOccurrences(of: ".bundle", with: "") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Constants.swift | ||
// virtualOS | ||
// | ||
// Created by Jahn Bertsch | ||
// | ||
|
||
import AppKit | ||
|
||
struct Constants { | ||
static let restoreImageNameLatest = "latest" | ||
static let selectedRestoreImage = "selectedRestoreImage" | ||
static let restoreImageNameSelectedNotification = Notification.Name("restoreImageSelected") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// FileModel.swift | ||
// virtualOS | ||
// | ||
// Created by Jahn Bertsch. | ||
// | ||
|
||
import Foundation | ||
|
||
struct FileModel { | ||
var bundleExists: Bool { | ||
return FileManager.default.fileExists(atPath: URL.vmBundleURL.path()) | ||
} | ||
|
||
var restoreImageExists: Bool { | ||
return FileManager.default.fileExists(atPath: URL.restoreImageURL.path) | ||
} | ||
|
||
var sharedFolderExists: Bool { | ||
// if let hardDiskDirectoryBookmarkData = Bookmark.startAccess(data: virtualMac.parameters.sharedFolder, forType: .hardDisk) { | ||
// var isDirectory = ObjCBool(false) | ||
// if FileManager.default.fileExists(atPath: hardDiskDirectoryBookmarkData.path, isDirectory: &isDirectory), | ||
// isDirectory.boolValue == true | ||
// { | ||
// return true | ||
// } | ||
// } | ||
return false | ||
} | ||
|
||
func getVMBundles() -> [VMBundle] { | ||
var result: [VMBundle] = [] | ||
if let urls = try? FileManager.default.contentsOfDirectory(at: URL.baseURL, includingPropertiesForKeys: nil, options: []) { | ||
for url in urls { | ||
if url.lastPathComponent.hasSuffix("bundle") { | ||
result.append(VMBundle(url: url)) | ||
} | ||
} | ||
} | ||
return result | ||
} | ||
|
||
func getRestoreImages() -> [String] { | ||
var result: [String] = [] | ||
|
||
if let urls = try? FileManager.default.contentsOfDirectory(at: URL.baseURL, includingPropertiesForKeys: nil, options: []) { | ||
for url in urls { | ||
if url.lastPathComponent.hasSuffix("ipsw") { | ||
result.append(url.lastPathComponent) | ||
} | ||
} | ||
} | ||
return result | ||
} | ||
|
||
} |
Oops, something went wrong.