diff --git a/changelog.d/+targetless-selection.fixed.md b/changelog.d/+targetless-selection.fixed.md new file mode 100644 index 00000000..122d524e --- /dev/null +++ b/changelog.d/+targetless-selection.fixed.md @@ -0,0 +1 @@ +Fixed a bug with selecting `targetless` option from the target selection dialog. \ No newline at end of file diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt index af7fbec0..4be92d19 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordExecManager.kt @@ -7,6 +7,7 @@ import com.intellij.openapi.components.service import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.openapi.util.SystemInfo import com.intellij.openapi.vfs.VirtualFileManager +import com.intellij.util.alsoIfNull import java.nio.file.Path /** @@ -135,8 +136,9 @@ class MirrordExecManager(private val service: MirrordProjectService) { val target = if (!targetSet) { // There is no config file or the config does not specify a target, so show dialog. MirrordLogger.logger.debug("target not selected, showing dialog") - chooseTarget(cli, wslDistribution, configPath).also { - if (it == MirrordExecDialog.targetlessTargetName) { + chooseTarget(cli, wslDistribution, configPath) + .takeUnless { it == MirrordExecDialog.targetlessTargetName } + .alsoIfNull { MirrordLogger.logger.info("No target specified - running targetless") service.notifier.notification( "No target specified, mirrord running targetless.", @@ -145,7 +147,6 @@ class MirrordExecManager(private val service: MirrordProjectService) { .withDontShowAgain(MirrordSettingsState.NotificationId.RUNNING_TARGETLESS) .fire() } - } } else { null }