From 7adfc8a54a0bbedd112411c3db8f143a83d527fb Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Fri, 26 Apr 2019 04:16:18 -0400 Subject: [PATCH] Mac fixes (#548) * Update FtlConstants.kt * Fix flank cancel --- test_runner/src/main/kotlin/ftl/config/FtlConstants.kt | 9 +++++++-- test_runner/src/main/kotlin/ftl/run/TestRunner.kt | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt b/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt index 9e752bea5f..b72c6e9972 100644 --- a/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt +++ b/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt @@ -27,8 +27,13 @@ import org.slf4j.LoggerFactory object FtlConstants { var useMock = false - // depending on environment, it's not always "Mac OS X" - val macOS: Boolean = (System.getProperty("os.name") ?: "").toLowerCase().indexOf("mac") >= 0 + + val macOS: Boolean by lazy { + val osName = System.getProperty("os.name") ?: "" + val isMacOS = osName.toLowerCase().indexOf("mac") >= 0 + println("isMacOS = $isMacOS ($osName)") + isMacOS + } const val localhost = "http://localhost:8080" const val defaultLocale = "en" diff --git a/test_runner/src/main/kotlin/ftl/run/TestRunner.kt b/test_runner/src/main/kotlin/ftl/run/TestRunner.kt index d6c7378cc6..69a3842bf1 100644 --- a/test_runner/src/main/kotlin/ftl/run/TestRunner.kt +++ b/test_runner/src/main/kotlin/ftl/run/TestRunner.kt @@ -143,7 +143,9 @@ object TestRunner { val resultsFile = Paths.get(args.localResultDir).toFile() if (!resultsFile.exists()) return null - val scheduledRuns = resultsFile.listFiles().filter { it.isDirectory }.sortedBy { it.lastModified() } + val scheduledRuns = resultsFile.listFiles() + .filter { it.isDirectory } + .sortedByDescending { it.lastModified() } if (scheduledRuns.isEmpty()) return null return scheduledRuns.first().name