From 134d0069fe10f7659aaf06264bbc130c3ecca43a Mon Sep 17 00:00:00 2001 From: Sergey Karashevich Date: Wed, 4 Jul 2018 10:28:25 +0300 Subject: [PATCH] [gui-test] do not add empty string to args if the platform prefix is empty or null Signed-off-by: Sergey Karashevich --- .../launcher/GuiTestLocalLauncher.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/launcher/GuiTestLocalLauncher.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/launcher/GuiTestLocalLauncher.kt index e5cad939a4bb..0a922d7ea456 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/launcher/GuiTestLocalLauncher.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/launcher/GuiTestLocalLauncher.kt @@ -223,7 +223,7 @@ object GuiTestLocalLauncher { .plus("-Didea.config.path=${GuiTestOptions.getConfigPath()}") .plus("-Didea.system.path=${GuiTestOptions.getSystemPath()}") .plus("-Dfile.encoding=${GuiTestOptions.getEncoding()}") - .plus(if (ide.ideType.platformPrefix.isNullOrEmpty()) "" else "-Didea.platform.prefix=${ide.ideType.platformPrefix}") + .plusIf(!ide.ideType.platformPrefix.isNullOrEmpty(), "-Didea.platform.prefix=${ide.ideType.platformPrefix}") .plus(customVmOptions) .plus("-Xdebug") .plus("-Xrunjdwp:transport=dt_socket,server=y,suspend=${GuiTestOptions.suspendDebug()},address=${GuiTestOptions.getDebugPort()}") @@ -390,4 +390,16 @@ object GuiTestLocalLauncher { return Paths.get(this.toURI()).toFile().path } + /** + * Returns a list containing all elements of the original collection and then the given [element]. + */ + private fun List.plusIf(condition: Boolean, element: T): List { + if (!condition) return this + val result = ArrayList(size + 1) + result.addAll(this) + result.add(element) + return result + } + + } \ No newline at end of file