Skip to content

Commit 92e52d3

Browse files
committed
(#22) Run configuration: empty working dir should behave as default
1 parent 6af34e4 commit 92e52d3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/kotlin/com/intellij/plugin/powershell/ide/run/PowerShellScriptCommandLineState.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.intellij.openapi.vfs.LocalFileSystem
2222
import com.intellij.plugin.powershell.lang.lsp.LSPInitMain
2323
import com.intellij.plugin.powershell.lang.lsp.languagehost.PowerShellNotInstalled
2424
import com.intellij.terminal.TerminalExecutionConsole
25+
import com.intellij.util.text.nullize
2526
import kotlinx.coroutines.Dispatchers
2627
import kotlinx.coroutines.withContext
2728
import org.jetbrains.annotations.TestOnly
@@ -45,7 +46,7 @@ class PowerShellScriptCommandLineState(
4546
ProjectRootManager.getInstance(project).fileIndex.getModuleForFile(it)
4647
}
4748
}
48-
workingDirectory = runConfiguration.customWorkingDirectory?.let {
49+
workingDirectory = runConfiguration.customWorkingDirectory.nullize(nullizeSpaces = true)?.let {
4950
toPath(ProgramParametersUtil.expandPathAndMacros(it, module, project))
5051
} ?: getDefaultWorkingDirectory(toPath(runConfiguration.scriptPath))
5152
}

src/test/kotlin/com/intellij/plugin/powershell/ide/run/PowerShellRunConfigurationTests.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ class PowerShellRunConfigurationTests : BasePlatformTestCase() {
2323
}
2424

2525
fun testNoCustomWorkingDirectory() {
26-
assertWorkingDirectory(custom = null, expected = projectPath.resolve("scripts"))
26+
assertWorkingDirectory(custom = null, expected = defaultWorkingDirectory)
27+
}
28+
29+
fun testEmptyCustomWorkingDirectory() {
30+
assertWorkingDirectory(custom = "", expected = defaultWorkingDirectory)
2731
}
2832

2933
fun testCustomWorkingDirectoryPathVariable() {

0 commit comments

Comments
 (0)