src/aws/install-aws-cli/src.main.kts [427:459]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun writeDebug(text: String) = writeMessage(text, TAGS_ATRRIBUTE to "tc:internal") fun writeWarning(text: String) = writeMessage(text, "status" to "WARNING") fun writeError(text: String) = writeMessage(text, "status" to "ERROR") fun writeMessage(text: String, vararg attributes: Pair) = println(asString(MESSAGE, mapOf("text" to text, *attributes))) fun File.getOrTemp(): File = this.toPath().getOrTemp().toFile() fun Path.getOrTemp(): Path { if (Files.notExists(this)) { try { Files.createDirectories(this) } catch (e: IOException) { return fallbackWithWarning(this, e) } } if (Files.isDirectory(this)) { try { Files.createTempFile(this, "write-test-", ".tmp").let { testFile -> Files.deleteIfExists(testFile) } return this } catch (e: IOException) { return fallbackWithWarning(this, e) } } return fallbackWithWarning(this, IOException("Not a directory")) } fun fallbackWithWarning(path: Path, cause: Exception): Path { val tmpDir = System.getProperty("java.io.tmpdir") ?: throw IllegalStateException("No 'java.io.tmpdir' defined", cause) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src/setup-node/src.main.kts [277:309]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun writeDebug(text: String) = writeMessage(text, TAGS_ATRRIBUTE to "tc:internal") fun writeWarning(text: String) = writeMessage(text, "status" to "WARNING") fun writeError(text: String) = writeMessage(text, "status" to "ERROR") fun writeMessage(text: String, vararg attributes: Pair) = println(asString(MESSAGE, mapOf("text" to text, *attributes))) fun File.getOrTemp(): File = this.toPath().getOrTemp().toFile() fun Path.getOrTemp(): Path { if (Files.notExists(this)) { try { Files.createDirectories(this) } catch (e: IOException) { return fallbackWithWarning(this, e) } } if (Files.isDirectory(this)) { try { Files.createTempFile(this, "write-test-", ".tmp").let { testFile -> Files.deleteIfExists(testFile) } return this } catch (e: IOException) { return fallbackWithWarning(this, e) } } return fallbackWithWarning(this, IOException("Not a directory")) } fun fallbackWithWarning(path: Path, cause: Exception): Path { val tmpDir = System.getProperty("java.io.tmpdir") ?: throw IllegalStateException("No 'java.io.tmpdir' defined", cause) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -