Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support R/W accessing image files on external drives #2451

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Managers/UTMQemuSystem.m
Expand Up @@ -233,6 +233,8 @@ - (void)argsForDrives {
if (hasImage) {
if ([path characterAtIndex:0] == '/') {
fullPathURL = [NSURL fileURLWithPath:path isDirectory:NO];
} else if ([path hasPrefix:@"file://"]) {
fullPathURL = [NSURL URLWithString:path];
} else {
fullPathURL = [[self.imgPath URLByAppendingPathComponent:[UTMConfiguration diskImagesDirectory]] URLByAppendingPathComponent:[self.configuration driveImagePathForIndex:i]];
}
Expand Down
4 changes: 2 additions & 2 deletions Managers/UTMVirtualMachine.m
Expand Up @@ -255,15 +255,15 @@ - (BOOL)saveUTMWithError:(NSError * _Nullable *)err {
}

- (void)errorTriggered:(nullable NSString *)msg {
if (self.state != kVMStopped && self.state != kVMError) {
/*if (self.state != kVMStopped && self.state != kVMError) {
self.viewState.suspended = NO;
[self saveViewState];
[self quitVMForce:true];
}
if (self.state != kVMError) { // don't stack errors
self.delegate.vmMessage = msg;
[self changeState:kVMError];
}
}*/
}

- (BOOL)startVM {
Expand Down
6 changes: 3 additions & 3 deletions Platform/UTMData.swift
Expand Up @@ -350,7 +350,7 @@ class UTMData: ObservableObject {

let name = drive.lastPathComponent
let imageType: UTMDiskImageType = drive.pathExtension.lowercased() == "iso" ? .CD : .disk
let imagesPath = config.imagesPath
/*let imagesPath = config.imagesPath
let dstPath = imagesPath.appendingPathComponent(name)
if !fileManager.fileExists(atPath: imagesPath.path) {
try fileManager.createDirectory(at: imagesPath, withIntermediateDirectories: false, attributes: nil)
Expand All @@ -359,15 +359,15 @@ class UTMData: ObservableObject {
try fileManager.copyItem(at: drive, to: dstPath)
} else {
try fileManager.moveItem(at: drive, to: dstPath)
}
}*/
DispatchQueue.main.async {
let interface: String
if let target = config.systemTarget {
interface = UTMConfiguration.defaultDriveInterface(forTarget: target, type: imageType)
} else {
interface = "none"
}
config.newDrive(name, type: imageType, interface: interface)
config.newDrive(drive.absoluteString, type: imageType, interface: interface)
}
}

Expand Down