Skip to content

Commit 69d01b5

Browse files
committed
refactor(file): remove leading slash from presentable paths
Simplify file path display by removing leading slashes when showing relative paths in the UI. This makes paths more consistent
1 parent ef602ee commit 69d01b5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/file/FilePresentation.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ data class FilePresentation(
3131
)
3232
}
3333

34-
private fun getPresentablePath(project: Project, file: VirtualFile): String =
35-
project.basePath?.let { basePath ->
34+
private fun getPresentablePath(project: Project, file: VirtualFile): String {
35+
val path = project.basePath?.let { basePath ->
3636
when (file.parent?.path) {
3737
basePath -> file.name
3838
else -> file.path.removePrefix(basePath)
3939
}
4040
} ?: file.path
41+
42+
return path.removePrefix("/")
43+
}
4144
}
4245

4346
fun relativePath(project: Project): String {

0 commit comments

Comments
 (0)