aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/renderers/FileWriter.kt7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/src/main/kotlin/renderers/FileWriter.kt b/core/src/main/kotlin/renderers/FileWriter.kt
index 319926dd..9ee02b4b 100644
--- a/core/src/main/kotlin/renderers/FileWriter.kt
+++ b/core/src/main/kotlin/renderers/FileWriter.kt
@@ -5,16 +5,17 @@ import java.io.IOException
import java.nio.file.Paths
class FileWriter(val root: String, val extension: String){
- private val createdFiles: MutableMap<String, Int> = mutableMapOf()
+ private val createdFiles: MutableSet<String> = mutableSetOf()
fun write(path: String, text: String, ext: String = extension){
- if (createdFiles.getOrDefault(path, 0) > 0) {
+ if (createdFiles.contains(path)) {
println("ERROR. An attempt to write $root/$path several times!")
return
}
+ createdFiles.add(path)
try {
- println("Writing $root/$path$ext")
+// println("Writing $root/$path$ext")
val dir = Paths.get(root, path.dropLastWhile { it != '/' }).toFile()
dir.mkdirsOrFail()
Paths.get(root, "$path$ext").toFile().writeText(text)