From ca8fbc1c0ac765640b60c406e5bb1d78973d0f98 Mon Sep 17 00:00:00 2001 From: Abe Pazos Date: Fri, 24 Jan 2025 21:54:08 +0100 Subject: [PATCH] CollectScreenShots: sort demos by absolute path This way demos in folders are shown together. --- buildSrc/src/main/kotlin/CollectScreenShots.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/CollectScreenShots.kt b/buildSrc/src/main/kotlin/CollectScreenShots.kt index fbdb1ad1..e42e711e 100644 --- a/buildSrc/src/main/kotlin/CollectScreenShots.kt +++ b/buildSrc/src/main/kotlin/CollectScreenShots.kt @@ -83,7 +83,7 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() { // this is only executed if there are changes in the inputDir val runDemos = outputDir.get().asFile.listFiles { file: File -> file.extension == "png" - }!!.map { it.nameWithoutExtension }.sortedBy { it.lowercase() } + }!!.sortedBy { it.absolutePath.lowercase() }.map { it.nameWithoutExtension } val readme = File(project.projectDir, "README.md") if (readme.exists()) { var lines = readme.readLines().toMutableList() @@ -102,10 +102,12 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() { } for (demo in runDemos) { val projectPath = project.projectDir.relativeTo(project.rootDir) + // Set the url to "" for local testing + val url = "https://raw.githubusercontent.com/openrndr/orx/media/$projectPath/" lines.add("### ${demo.dropLast(2).replace("-","/")}") lines.add("[source code](src/${demoModuleName}/kotlin/${demo.dropLast(2).replace("-", "/")}.kt)") lines.add("") - lines.add("![${demo}](https://raw.githubusercontent.com/openrndr/orx/media/$projectPath/images/${demo}.png)") + lines.add("![${demo}](${url}images/${demo}.png)") lines.add("") } readme.delete()