feat(IconExporter): ZIP 구조 변경 - items 폴더 추가
- 이미지 파일을 icons/items/<name>.png에 저장 - ZIP 구조: metadata.json + items/<name>.png - 압축 후 items 폴더 삭제
This commit is contained in:
parent
215baf9361
commit
695bc79ca4
1 changed files with 23 additions and 20 deletions
|
|
@ -167,13 +167,13 @@ object IconExportManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 아이템 ID로 출력 경로 생성 형식: icons/<path>.png 예: icons/brass_casing.png */
|
/** 아이템 ID로 출력 경로 생성 형식: icons/items/<path>.png 예: icons/items/brass_casing.png */
|
||||||
private fun getOutputPath(namespace: String, path: String): Path {
|
private fun getOutputPath(namespace: String, path: String): Path {
|
||||||
val mc = Minecraft.getInstance()
|
val mc = Minecraft.getInstance()
|
||||||
val gameDir = mc.gameDirectory.toPath()
|
val gameDir = mc.gameDirectory.toPath()
|
||||||
|
|
||||||
// icons/<path>.png (단일 폴더)
|
// icons/items/<path>.png
|
||||||
return gameDir.resolve("icons").resolve("$path.png")
|
return gameDir.resolve("icons").resolve("items").resolve("$path.png")
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 진행률 로그 출력 */
|
/** 진행률 로그 출력 */
|
||||||
|
|
@ -289,17 +289,20 @@ object IconExportManager {
|
||||||
zos.write(metadata.toByteArray(Charsets.UTF_8))
|
zos.write(metadata.toByteArray(Charsets.UTF_8))
|
||||||
zos.closeEntry()
|
zos.closeEntry()
|
||||||
|
|
||||||
// PNG 파일 추가 (모든 파일을 단순히 파일명만으로 압축)
|
// PNG 파일 추가 (items/ 폴더 구조 유지)
|
||||||
Files.walk(iconsDir).use { paths ->
|
val itemsDir = iconsDir.resolve("items")
|
||||||
paths.filter { Files.isRegularFile(it) && it.name.endsWith(".png") }.forEach { file
|
if (itemsDir.exists()) {
|
||||||
->
|
Files.walk(itemsDir).use { paths ->
|
||||||
try {
|
paths.filter { Files.isRegularFile(it) && it.name.endsWith(".png") }.forEach {
|
||||||
// ZIP 내 경로: 파일명만 사용 (예: brass_casing.png)
|
file ->
|
||||||
zos.putNextEntry(ZipEntry(file.name))
|
try {
|
||||||
Files.copy(file, zos)
|
// ZIP 내 경로: items/<name>.png
|
||||||
zos.closeEntry()
|
zos.putNextEntry(ZipEntry("items/${file.name}"))
|
||||||
} catch (e: Exception) {
|
Files.copy(file, zos)
|
||||||
IconExporter.LOGGER.error("ZIP에 파일 추가 실패: {} - {}", file, e.message)
|
zos.closeEntry()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
IconExporter.LOGGER.error("ZIP에 파일 추가 실패: {} - {}", file, e.message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -307,15 +310,15 @@ object IconExportManager {
|
||||||
|
|
||||||
IconExporter.LOGGER.info("ZIP 압축 완료: {}", zipPath)
|
IconExporter.LOGGER.info("ZIP 압축 완료: {}", zipPath)
|
||||||
|
|
||||||
// 압축 완료 후 원본 PNG 파일 삭제 (ZIP 파일 제외)
|
// 압축 완료 후 items 폴더 삭제
|
||||||
try {
|
try {
|
||||||
Files.list(iconsDir).use { files ->
|
val itemsDir = iconsDir.resolve("items")
|
||||||
files.filter { Files.isRegularFile(it) && it.name.endsWith(".png") }.forEach { file
|
if (itemsDir.exists()) {
|
||||||
->
|
Files.walk(itemsDir).sorted(Comparator.reverseOrder()).forEach { path ->
|
||||||
try {
|
try {
|
||||||
Files.delete(file)
|
Files.delete(path)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
IconExporter.LOGGER.error("파일 삭제 실패: {} - {}", file, e.message)
|
IconExporter.LOGGER.error("파일 삭제 실패: {} - {}", path, e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue