@@ -250,42 +250,17 @@ class CoderSettingsStore(
250250 /* *
251251 * Return the name of the binary (with extension) for the provided OS and architecture.
252252 */
253- private fun getCoderCLIForOS (
254- os : OS ? ,
255- arch : Arch ? ,
256- ): String {
253+ private fun getCoderCLIForOS (os : OS ? , arch : Arch ? ): String {
257254 logger.debug(" Resolving binary for $os $arch " )
258- return buildCoderFileName(os, arch)
259- }
260-
261- /* *
262- * Return the name of the signature file (.asc) for the provided OS and architecture.
263- */
264- private fun getCoderSignatureForOS (
265- os : OS ? ,
266- arch : Arch ? ,
267- ): String {
268- logger.debug(" Resolving signature for $os $arch " )
269- return buildCoderFileName(os, arch, true )
270- }
271-
272- /* *
273- * Build the coder file name based on OS, architecture, and whether it's a signature file.
274- */
275- private fun buildCoderFileName (
276- os : OS ? ,
277- arch : Arch ? ,
278- isSignature : Boolean = false
279- ): String {
280- if (os == null ) {
281- logger.error(" Could not resolve client OS and architecture, defaulting to WINDOWS AMD64" )
282- return if (isSignature) " coder-windows-amd64.asc" else " coder-windows-amd64.exe"
283- }
284255
285- val osName = when (os) {
286- OS .WINDOWS -> " windows"
287- OS .LINUX -> " linux"
288- OS .MAC -> " darwin"
256+ val (osName, extension) = when (os) {
257+ OS .WINDOWS -> " windows" to " .exe"
258+ OS .LINUX -> " linux" to " "
259+ OS .MAC -> " darwin" to " "
260+ null -> {
261+ logger.error(" Could not resolve client OS and architecture, defaulting to WINDOWS AMD64" )
262+ return " coder-windows-amd64.exe"
263+ }
289264 }
290265
291266 val archName = when (arch) {
@@ -295,14 +270,17 @@ class CoderSettingsStore(
295270 else -> " amd64" // default fallback
296271 }
297272
298- val extension = if (isSignature) " .asc" else when (os) {
299- OS .WINDOWS -> " .exe"
300- OS .LINUX , OS .MAC -> " "
301- }
302-
303273 return " coder-$osName -$archName$extension "
304274 }
305275
276+ /* *
277+ * Return the name of the signature file (.asc) for the provided OS and architecture.
278+ */
279+ private fun getCoderSignatureForOS (os : OS ? , arch : Arch ? ): String {
280+ logger.debug(" Resolving signature for $os $arch " )
281+ return " ${getCoderCLIForOS(os, arch)} .asc"
282+ }
283+
306284 /* *
307285 * Append the host to the path. For example, foo/bar could become
308286 * foo/bar/dev.coder.com-8080.
0 commit comments