[gui-test] do not add empty string to args if the platform prefix is empty or null

Signed-off-by: Sergey Karashevich <sergey.karashevich@jetbrains.com>
This commit is contained in:
Sergey Karashevich
2018-07-04 10:31:41 +03:00
parent 126907b3b8
commit 134d0069fe
@@ -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 <T> List<T>.plusIf(condition: Boolean, element: T): List<T> {
if (!condition) return this
val result = ArrayList<T>(size + 1)
result.addAll(this)
result.add(element)
return result
}
}