Skip to content
This repository was archived by the owner on Dec 17, 2018. It is now read-only.

Commit 13e9ece

Browse files
committed
Handle this for Linux
1 parent d90cea4 commit 13e9ece

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/LanguageServerProtocol/Types/Server.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ private let log = OSLog(subsystem: "me.lovelett.langserver-swift", category: "Wo
3636
///
3737
/// - Returns: The absolute path to the bin directory containing the Swift compiler.
3838
func findBinDirectory() -> AbsolutePath {
39+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
3940
let whichSwiftcArgs = ["xcrun", "--find", "swiftc"]
4041
// No value in env, so search for `clang`.
4142
let foundPath = (try? Process.checkNonZeroExit(arguments: whichSwiftcArgs).chomp()) ?? ""
@@ -44,6 +45,9 @@ func findBinDirectory() -> AbsolutePath {
4445
return AbsolutePath("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin")
4546
}
4647
return AbsolutePath(foundPath).parentDirectory
48+
#else
49+
return AbsolutePath("/usr/bin/swiftc").parentDirectory
50+
#endif
4751
}
4852

4953
/// A directory on the local filesystem that contains all of the sources of the Swift project.

0 commit comments

Comments
 (0)