Skip to content

Commit

Permalink
fix terminal command generation (#889)
Browse files Browse the repository at this point in the history
* fix the terminal command generation to run the executable instead of a directory

* fix swiftlint violations

Signed-off-by: iivusly <[email protected]>

---------

Signed-off-by: iivusly <[email protected]>
  • Loading branch information
iivusly authored Mar 28, 2024
1 parent 977ff34 commit 90c9561
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ extension Program {
}

public func generateTerminalCommand() -> String {
return Wine.generateRunCommand(bottle: bottle, args: settings.arguments, environment: generateEnvironment())
return Wine.generateRunCommand(
at: self.url, bottle: bottle, args: settings.arguments, environment: generateEnvironment()
)
}

public func runInTerminal() {
Expand Down
6 changes: 4 additions & 2 deletions WhiskyKit/Sources/WhiskyKit/Wine/Wine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ public class Wine {
) { }
}

public static func generateRunCommand(bottle: Bottle, args: String, environment: [String: String]) -> String {
var wineCmd = "\(wineBinary.esc) start /unix \(bottle.url.esc) \(args)"
public static func generateRunCommand(
at url: URL, bottle: Bottle, args: String, environment: [String: String]
) -> String {
var wineCmd = "\(wineBinary.esc) start /unix \(url.path(percentEncoded: false)) \(args)"
let env = constructWineEnvironment(for: bottle, environment: environment)
for environment in env {
wineCmd = "\(environment.key)=\(environment.value) " + wineCmd
Expand Down

0 comments on commit 90c9561

Please sign in to comment.