From fc7427ca3ce12b3c698b65b032b19c874a33af2a Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Sun, 26 Jul 2026 03:11:44 +0000
Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A3=A8=ED=8A=B8=20=EB=94=94=EB=A0=89?=
=?UTF-8?q?=ED=86=A0=EB=A6=AC=20=ED=91=9C=EC=8B=9C=20=EC=9D=B4=EB=A6=84=20?=
=?UTF-8?q?=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.jules/palette.md | 4 ++++
src/main/kotlin/html4tree/main.kt | 6 ++++--
src/test/kotlin/html4tree/MainTest.kt | 12 ++++++++++++
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/.jules/palette.md b/.jules/palette.md
index 9a12c9de..d6b10d64 100644
--- a/.jules/palette.md
+++ b/.jules/palette.md
@@ -48,3 +48,7 @@
## 2024-08-01 - 네이티브 브라우저 UI의 다크 모드 지원 강제
**학습:** CSS 미디어 쿼리(`@media (prefers-color-scheme: dark)`)를 통해 다크 모드를 지원하더라도, 브라우저의 네이티브 UI 요소(스크롤바, 기본 폼 컨트롤, 기본 백그라운드 등)는 테마 변경을 인식하지 못해 어두운 테마 환경에서 밝은 스크롤바가 표시되는 등 시각적 불일치를 초래합니다.
**조치:** 항상 HTML 문서의 `
` 영역에 `` 메타 태그를 명시적으로 추가하여 브라우저 수준에서 사용자의 시스템 테마(다크 모드 등)를 완전히 상속받아 일관성 있는 네이티브 UI를 렌더링하도록 보장하십시오.
+
+## 2026-07-26 - 루트 디렉토리 표시 이름 예외 처리
+**Learning:** 파일 시스템 루트(예: `/` 또는 `C:\`)의 경우 `File.getName()`은 빈 문자열을 반환합니다. 이를 처리하지 않고 기본값으로 사용하면 생성된 HTML 디렉토리 트리의 `` 및 `
`가 비어 있게 되어, 스크린 리더 사용자에게 컨텍스트를 제공하지 못하고 웹 접근성을 해치게 됩니다.
+**Action:** `File.getName()`을 사용할 때 `ifEmpty`와 같은 Fallback을 통해 `absolutePath` 등을 대체 문자열로 제공하여, 루트 디렉토리에서도 UI 제목이 의미 있는 값을 가지도록 구현하십시오.
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index b4558624..e39c8239 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -317,6 +317,8 @@ fun process_dir(curr_dir: File, excludeSet: Set? = null, dirFiles: Array
${cssContent}
"""
+ val dirNameToDisplay = curr_dir.getName().ifEmpty { curr_dir.absolutePath }
+
val index_top = """
@@ -327,12 +329,12 @@ ${cssContent}
- ${curr_dir.getName().escapeHtml()}
+ ${dirNameToDisplay.escapeHtml()}
${css}
-