Skip to content

Commit

Permalink
Fix pins not respecting program arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Oct 10, 2023
1 parent ed0757b commit 88513a2
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Whisky/Views/Bottle Views/BottleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ struct WinetricksView: View {
struct PinnedProgramView: View {
var bottle: Bottle
@State var pin: PinnedProgram
@State var program: Program?
@State var image: NSImage?
@State var showRenameSheet = false
@State var name: String = ""
Expand Down Expand Up @@ -265,10 +266,9 @@ struct PinnedProgramView: View {
}
Divider()
Button("program.config") {
let program = Program(name: pin.name,
url: pin.url,
bottle: bottle)
path.append(program)
if let program {
path.append(program)
}
}
Divider()
Button("button.rename") {
Expand All @@ -291,11 +291,11 @@ struct PinnedProgramView: View {
.onAppear {
name = pin.name
Task.detached {
let program = Program(name: pin.name,
url: pin.url,
bottle: bottle)
if let peFile = program.peFile {
image = peFile.bestIcon()
program = bottle.programs.first(where: { $0.url == pin.url })
if let program {
if let peFile = program.peFile {
image = peFile.bestIcon()
}
}
}
}
Expand All @@ -314,11 +314,11 @@ struct PinnedProgramView: View {
opening = false
}
}
let program = Program(name: pin.name,
url: pin.url,
bottle: bottle)
Task {
await program.run()

if let program {
Task {
await program.run()
}
}
}
}

0 comments on commit 88513a2

Please sign in to comment.