File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/main/kotlin/com/coder/gateway/sdk Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.coder.gateway.sdk
33import com.intellij.openapi.diagnostic.Logger
44import java.io.InputStream
55import java.net.URL
6+ import java.nio.file.FileVisitOption
67import java.nio.file.Files
78import java.nio.file.Path
89import java.nio.file.Paths
@@ -67,9 +68,14 @@ class CoderCLIManager(url: URL, buildVersion: String) {
6768 }
6869
6970 fun removeOldCli () {
70- Files .walk(Path .of(tmpDir)).sorted().map { it.toFile() }.filter { it.name.contains(cliNamePrefix) && ! it.name.contains(cliFileName) }.forEach {
71- logger.info(" Removing $it because it is an old coder cli" )
72- it.delete()
71+ val tmpPath = Path .of(tmpDir)
72+ if (Files .isReadable(tmpPath)) {
73+ Files .walk(tmpPath, 1 ).use {
74+ it.sorted().map { pt -> pt.toFile() }.filter { fl -> fl.name.contains(cliNamePrefix) && ! fl.name.contains(cliFileName) }.forEach { fl ->
75+ logger.info(" Removing $fl because it is an old coder cli" )
76+ fl.delete()
77+ }
78+ }
7379 }
7480 }
7581
You can’t perform that action at this time.
0 commit comments