project: fix some warnings

This commit is contained in:
osy 2023-08-25 11:21:29 -07:00
parent 2cd0fc4cbf
commit f026866d45
11 changed files with 15 additions and 17 deletions

View File

@ -20,7 +20,7 @@
#else
#import <AppKit/AppKit.h>
#endif
#import "UTMLegacyQemuConfiguration+Constants.h""
#import "UTMLegacyQemuConfiguration+Constants.h"
#import "UTMLegacyQemuConfiguration+Display.h"
#import "UTMLegacyQemuConfiguration+Sharing.h"
#import "UTMLegacyQemuConfiguration+System.h"

View File

@ -189,7 +189,7 @@ extension UTMConfiguration {
} else {
let newUrl = UTMData.newImage(from: sourceURL, to: destFolderURL)
try await Task.detached {
try fileManager.copyItem(at: sourceURL, to: newUrl)
try FileManager.default.copyItem(at: sourceURL, to: newUrl)
}.value
return destURL
}
@ -204,7 +204,7 @@ extension UTMConfiguration {
try await Task.detached {
for dataFileURL in dataFileURLs {
if !existingNames.contains(dataFileURL.lastPathComponent) {
try fileManager.removeItem(at: dataFileURL)
try FileManager.default.removeItem(at: dataFileURL)
}
}
}.value

View File

@ -91,10 +91,9 @@ extension UTMConfigurationDrive {
}
private func createRawImage(at newURL: URL, size sizeMib: Int) async throws {
let fileManager = FileManager.default
let size = UInt64(sizeMib) * bytesInMib
try await Task.detached {
guard fileManager.createFile(atPath: newURL.path, contents: nil, attributes: nil) else {
guard FileManager.default.createFile(atPath: newURL.path, contents: nil, attributes: nil) else {
throw UTMConfigurationError.cannotCreateDiskImage
}
let handle = try FileHandle(forWritingTo: newURL)
@ -113,7 +112,6 @@ extension UTMConfigurationDrive {
#if os(macOS)
private func convertQcow2Image(at sourceURL: URL, to destFolderURL: URL) async throws -> URL {
let fileManager = FileManager.default
let destQcow2 = UTMData.newImage(from: sourceURL,
to: destFolderURL,
withExtension: "qcow2")

View File

@ -321,7 +321,7 @@ extension UTMQemuConfiguration {
throw UTMQemuConfigurationError.migrationFailed
}
try await Task.detached {
try fileManager.moveItem(at: imagesURL, to: dataURL)
try FileManager.default.moveItem(at: imagesURL, to: dataURL)
}.value
}
// update any drives
@ -334,7 +334,7 @@ extension UTMQemuConfiguration {
if information.isIconCustom, let oldIconURL = information.iconURL {
let newIconURL = dataURL.appendingPathComponent(oldIconURL.lastPathComponent)
try await Task.detached {
try fileManager.moveItem(at: oldIconURL, to: newIconURL)
try FileManager.default.moveItem(at: oldIconURL, to: newIconURL)
}.value
information.iconURL = newIconURL
}
@ -343,10 +343,10 @@ extension UTMQemuConfiguration {
let newLogURL = dataURL.appendingPathComponent(oldLogURL.lastPathComponent)
await Task.detached {
do {
try fileManager.moveItem(at: oldLogURL, to: newLogURL)
try FileManager.default.moveItem(at: oldLogURL, to: newLogURL)
} catch {
// okay to fail
try? fileManager.removeItem(at: oldLogURL)
try? FileManager.default.removeItem(at: oldLogURL)
}
}.value
qemu.debugLogURL = newLogURL

View File

@ -179,7 +179,7 @@ extension UTMQemuConfigurationQEMU {
let varsURL = dataURL.appendingPathComponent(QEMUPackageFileName.efiVariables.rawValue)
if !fileManager.fileExists(atPath: varsURL.path) {
try await Task.detached {
try fileManager.copyItem(at: templateVarsURL, to: varsURL)
try FileManager.default.copyItem(at: templateVarsURL, to: varsURL)
}.value
}
efiVarsURL = varsURL

View File

@ -71,7 +71,7 @@ import SwiftUI
override func showKeyboard() {
super.showKeyboard()
terminalView.becomeFirstResponder()
_ = terminalView.becomeFirstResponder()
}
override func hideKeyboard() {

View File

@ -64,7 +64,7 @@ fileprivate struct WizardToolbar: ViewModifier {
data.busyWorkAsync {
let config = try await wizardState.generateConfig()
if let qemuConfig = config as? UTMQemuConfiguration {
let vm = try await data.create(config: qemuConfig)
_ = try await data.create(config: qemuConfig)
if #available(iOS 15, *) {
// This is broken on iOS 14
await MainActor.run {

View File

@ -14,7 +14,7 @@
// limitations under the License.
//
protocol VMMetalViewInputDelegate: class {
protocol VMMetalViewInputDelegate: AnyObject {
var shouldUseCmdOptForCapture: Bool { get }
func mouseMove(absolutePoint: CGPoint, button: CSInputButton)
func mouseMove(relativePoint: CGPoint, button: CSInputButton)

View File

@ -173,7 +173,7 @@ struct VMAppleRemovableDrivesView: View {
}
private func selectShareDirectory(for binding: Binding<UTMRegistryEntry.File>, result: Result<URL, Error>) {
data.busyWorkAsync {
data.busyWork {
let url = try result.get()
binding.wrappedValue.url = url
}

View File

@ -112,7 +112,7 @@ struct VMWizardView: View {
}
#endif
if let qemuConfig = config as? UTMQemuConfiguration {
let vm = try await data.create(config: qemuConfig)
_ = try await data.create(config: qemuConfig)
await MainActor.run {
qemuConfig.qemu.isGuestToolsInstallRequested = wizardState.isGuestToolsInstallRequested
}

View File

@ -93,7 +93,7 @@ NSString *const kUTMErrorDomain = @"com.utmapp.utm";
[self.spice spiceSetDebug:YES];
}
// do not need to encode/decode audio locally
g_setenv("SPICE_DISABLE_OPUS", "1", TRUE);
g_setenv("SPICE_DISABLE_OPUS", "1", YES);
// need to chdir to workaround AF_UNIX sun_len limitations
NSString *curdir = self.socketUrl.URLByDeletingLastPathComponent.path;
if (!curdir || ![NSFileManager.defaultManager changeCurrentDirectoryPath:curdir]) {