Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marzent committed Jan 20, 2022
1 parent 3b7cea6 commit 429df69
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 48 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
filePath = "XIV on Mac/InstallerController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "194"
endingLineNumber = "194"
startingLineNumber = "182"
endingLineNumber = "182"
landmarkName = "cancelInstall(_:)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -62,8 +62,8 @@
filePath = "XIV on Mac/InstallerController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "180"
endingLineNumber = "180"
startingLineNumber = "168"
endingLineNumber = "168"
landmarkName = "isValidGameDirectory(gamePath:)"
landmarkType = "7">
</BreakpointContent>
Expand Down
2 changes: 1 addition & 1 deletion XIV on Mac/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}

@IBAction func cmd(_ sender: Any) {
Util.launchWine(args: ["cmd"]) //fixme
Util.launchWine(args: ["wineconsole"])
}

@IBAction func dxvkSettings(_ sender: Any) {
Expand Down
74 changes: 31 additions & 43 deletions XIV on Mac/InstallerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,8 @@ class InstallerController: NSViewController {
return result == .alertFirstButtonReturn
}
}
do {
if try await alertTask.result.get() {
return gamePath
}
}
catch {
if try! await alertTask.result.get() {
return gamePath
}
}
}
Expand All @@ -124,47 +120,39 @@ class InstallerController: NSViewController {
return result == .alertFirstButtonReturn
}
}
do {
if try await alertTask.result.get() {
let openTask = Task { () -> String? in
let openPanel = NSOpenPanel()
openPanel.title = "Choose the folder with the existing install"
if #available(macOS 11.0, *) {
openPanel.subtitle = "It should contain the folders \"game\" and \"boot\" and the game executable."
}
openPanel.showsResizeIndicator = true
openPanel.showsHiddenFiles = true
openPanel.canChooseDirectories = true
openPanel.canChooseFiles = false
openPanel.canCreateDirectories = false
openPanel.allowsMultipleSelection = false
let result = await openPanel.beginSheetModal(for: view.window!)
if result != .OK {
return nil
}
let openPath = openPanel.url!.path
openPanel.close()
if (self.isValidGameDirectory(gamePath: openPath)) {
return openPath
}
let alert = NSAlert()
alert.messageText = "Invalid FFXIV Directory"
alert.informativeText = "It should contain the folders \"game\" and \"boot\" and the game executable and not be located inside the XIV on Mac wine prefix."
alert.alertStyle = .critical
alert.addButton(withTitle: "By the Twelve!")
await alert.beginSheetModal(for: self.view.window!)
return nil
if try! await alertTask.result.get() {
let openTask = Task { () -> String? in
let openPanel = NSOpenPanel()
openPanel.title = "Choose the folder with the existing install"
if #available(macOS 11.0, *) {
openPanel.subtitle = "It should contain the folders \"game\" and \"boot\" and the game executable."
}
do {
if let gamePath = try await openTask.result.get() {
return gamePath
}
openPanel.showsResizeIndicator = true
openPanel.showsHiddenFiles = true
openPanel.canChooseDirectories = true
openPanel.canChooseFiles = false
openPanel.canCreateDirectories = false
openPanel.allowsMultipleSelection = false
let result = await openPanel.beginSheetModal(for: view.window!)
openPanel.close()
if result != .OK {
return nil
}
catch {
let openPath = openPanel.url!.path
if (self.isValidGameDirectory(gamePath: openPath)) {
return openPath
}
let alert = NSAlert()
alert.messageText = "Invalid FFXIV Directory"
alert.informativeText = "It should contain the folders \"game\" and \"boot\" and the game executable and not be located inside the XIV on Mac wine prefix."
alert.alertStyle = .critical
alert.addButton(withTitle: "By the Twelve!")
await alert.beginSheetModal(for: self.view.window!)
return nil
}
if let gamePath = try! await openTask.result.get() {
return gamePath
}
}
catch {
}
return nil
}
Expand Down

0 comments on commit 429df69

Please sign in to comment.