From 6703b0859c2e32c38cb93515b9af43e390c4f8ca Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 7 Apr 2019 18:10:42 +0200 Subject: Added sorting of files --- src/main/kotlin/App.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main/kotlin/App.kt b/src/main/kotlin/App.kt index f69a960..dde993a 100644 --- a/src/main/kotlin/App.kt +++ b/src/main/kotlin/App.kt @@ -77,13 +77,14 @@ fun crawlFiles(ctx: Context) { .drop(fileHome.length + (if (ctx.splats()[0].isNotEmpty()) ctx.splats()[0].length + 2 else 1)) val filePath = "$fileHome${it.toString().drop(fileHome.length)}" files.add(if (File(filePath).isDirectory) "$fileName/" else fileName) - ctx.render( - "files.rocker.html", model( - "files", files, - "path", ctx.splats()[0] - ) - ) } + files.sortWith(String.CASE_INSENSITIVE_ORDER) + ctx.render( + "files.rocker.html", model( + "files", files, + "path", ctx.splats()[0] + ) + ) } else ctx.render( "fileview.rocker.html", model( -- cgit v1.2.3