Skip to content

Commit

Permalink
feat: print the extracted template file on the screen and fix templat…
Browse files Browse the repository at this point in the history
…e build error
  • Loading branch information
teixeira0x committed Oct 26, 2024
1 parent 4223f64 commit 26cb28c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/src/main/kotlin/com/teixeira/gdx/writer/ProjectWriter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ProjectWriter(
}

resourceStream.use { inputStream ->
sendMessage("Creating project...")
sendMessage("Extracting project template ...")

val buffer = ByteArray(1024)
val zis = ZipInputStream(inputStream)
Expand All @@ -53,8 +53,10 @@ class ProjectWriter(
val file = File(projectDir, name)

if (entry.isDirectory) {
sendMessage("Creating dir: ${file.canonicalPath}")
file.mkdirs()
} else {
sendMessage("Extracting file: ${file.canonicalPath}")
file.parentFile?.mkdirs()

if (file.extension.matches(SOURCE_FILES_REGEX)) {
Expand All @@ -77,12 +79,15 @@ class ProjectWriter(
}
}

zis.closeEntry()
entry = zis.nextEntry
}
zis.closeEntry()
zis.close()

unzipGradleWrapper(projectDir, sendMessage)

sendMessage("Project created in: ${projectDir.canonicalPath}")
}
}

Expand Down Expand Up @@ -110,12 +115,13 @@ class ProjectWriter(
fos.write(buffer, 0, len)
}
}

zis.closeEntry()
entry = zis.nextEntry
}
zis.closeEntry()
zis.close()

sendMessage("Gradle Wrapper extracted.")
}
sendMessage("Project created.")
}
}
Binary file modified app/src/main/resources/template_java.zip
Binary file not shown.
Binary file modified app/src/main/resources/template_kotlin.zip
Binary file not shown.

0 comments on commit 26cb28c

Please sign in to comment.