Skip to content

Commit 540ff01

Browse files
committed
Detect Docker socket in new user location.
1 parent 2fa80c0 commit 540ff01

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

Ace Link/AppDelegate.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2626
}
2727

2828
func application(_: NSApplication, open urls: [URL]) {
29-
if Process.runCommand("docker", "--version").terminationStatus != 0 {
30-
return
31-
}
29+
if Process.runCommand("docker", "--version").terminationStatus != 0 {
30+
return
31+
}
3232
if let url = urls.first, let stream = ExtractStream.from(applicationURL: url) {
3333
openStream(stream)
3434
} else {

Ace Link/Extensions/Process.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,33 @@ extension Process {
1616
set { standardErrorMap.setObject(NSString(string: newValue), forKey: self) }
1717
}
1818

19+
var userDockerSocket: String? {
20+
let home = FileManager.default.homeDirectoryForCurrentUser
21+
let userSocketPath = home.path + "/.docker/run/docker.sock"
22+
if FileManager.default.fileExists(atPath: userSocketPath) {
23+
return userSocketPath
24+
}
25+
return nil
26+
}
27+
1928
static func runCommand(_ arguments: String...) -> Self {
2029
let process = Self()
2130

2231
process.launchPath = "/usr/bin/env"
2332
process.arguments = arguments
2433
process.environment = [
34+
// Modify PATH to include dirs containing local binaries.
2535
"PATH": ProcessInfo.processInfo.environment["PATH"]! + ":/usr/local/bin:/opt/local/bin",
36+
// Don't attempt to download/run arm64 packages because they're not supported.
2637
"DOCKER_DEFAULT_PLATFORM": "linux/amd64",
2738
]
2839

40+
// Docker-for-Mac allows both /Users/<user>/.docker/run/docker.sock (new)
41+
// and /var/run/docker.sock (legacy but supported).
42+
if let userDockerSocket = process.userDockerSocket {
43+
process.environment?["DOCKER_HOST"] = "unix://" + userDockerSocket
44+
}
45+
2946
os_log("Running command: %{public}@", arguments.joined(separator: " ").scrubHashes())
3047

3148
let outputPipe = Pipe(), errorPipe = Pipe()

Ace Link/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>2.0.5</string>
20+
<string>2.0.6</string>
2121
<key>CFBundleURLTypes</key>
2222
<array>
2323
<dict>

Ace Link/Menu/SelectPlayerMenu.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ class SelectPlayerMenu: PartialMenu {
7171
private func warnCapabilities(bundle: Bundle) {
7272
if bundle.supports(fileExtension: "mkv") {
7373
// Players that support mkv will likely play anything you throw at it.
74-
// Typically we need h264, ac3, adts and ts support, however streams could use any codec.
75-
// Browsers are unable to play the adts audio codec, which is relatively popular in streams.
74+
// Typically we need h264, ac3, adts and ts support, however streams could use any
75+
// codec.
76+
// Browsers are unable to play the adts audio codec, which is relatively popular in
77+
// streams.
7678
return
7779
}
7880

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Ace Link is a menu bar app that allows playing Ace Streams on macOS.
44

55
Play an Ace Stream or Magnet in any media player by pasting the URL in the Ace Link menu, or open an acestream or magnet link in Ace Link.
66

7-
## [Download for macOS](https://github.com/blaise-io/acelink/releases/download/2.0.5/Ace.Link.2.0.5.dmg)
7+
## [Download for macOS](https://github.com/blaise-io/acelink/releases/download/2.0.6/Ace.Link.2.0.6.dmg)
88

99
- Install using HomeBrew: `brew install --cask ace-link`
1010
- [Download an older version](https://github.com/blaise-io/acelink/releases)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.5
1+
2.0.6

0 commit comments

Comments
 (0)