Skip to content

Commit 148ce6c

Browse files
committed
handle missing mutagen
1 parent cfb09d6 commit 148ce6c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Coder Desktop/Coder Desktop/FileSync/FileSyncDaemon.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MutagenDaemon: FileSyncDaemon {
1818

1919
private var mutagenProcess: Process?
2020
private var mutagenPipe: Pipe?
21-
private let mutagenPath: URL
21+
private let mutagenPath: URL!
2222
private let mutagenDataDirectory: URL
2323
private let mutagenDaemonSocket: URL
2424

@@ -28,10 +28,11 @@ class MutagenDaemon: FileSyncDaemon {
2828

2929
init() {
3030
#if arch(arm64)
31-
mutagenPath = Bundle.main.url(forResource: "mutagen-darwin-arm64", withExtension: nil)!
31+
mutagenPath = Bundle.main.url(forResource: "mutagen-darwin-arm64", withExtension: nil)
3232
#elseif arch(x86_64)
33-
mutagenPath = Bundle.main.url(forResource: "mutagen-darwin-amd64", withExtension: nil)!
33+
mutagenPath = Bundle.main.url(forResource: "mutagen-darwin-amd64", withExtension: nil)
3434
#else
35+
mutagenPath = nil
3536
fatalError("unknown architecture")
3637
#endif
3738
mutagenDataDirectory = FileManager.default.urls(
@@ -41,7 +42,7 @@ class MutagenDaemon: FileSyncDaemon {
4142
mutagenDaemonSocket = mutagenDataDirectory.appending(path: "daemon").appending(path: "daemon.sock")
4243
// It shouldn't be fatal if the app was built without Mutagen embedded,
4344
// but file sync will be unavailable.
44-
if !FileManager.default.fileExists(atPath: mutagenPath.path) {
45+
if mutagenPath == nil {
4546
logger.warning("Mutagen not embedded in app, file sync will be unavailable")
4647
state = .unavailable
4748
}

0 commit comments

Comments
 (0)