intellij-powershell icon indicating copy to clipboard operation
intellij-powershell copied to clipboard

Run configuration working directory and relative paths

Open Krande opened this issue 4 years ago • 0 comments

Hi,

as requested here is some further explaining of my comments made in #22 Note I am using Windows 10 and pycharm 2021.1.2 professional.

When I initially created my config file (leaving everything blank as shown below)

image

it creates a config file with the following content

<component name="ProjectRunConfigurationManager">
    <configuration default="false" name="test_script.ps1" type="PowerShellRunType" factoryName="PowerShell"
                   scriptUrl="$PROJECT_DIR$/test_rel_ps_path/test_script.ps1" workingDirectory="C:\Users\Kristoffer"
                   executablePath="$PROJECT_DIR$/../../../Windows/System32/WindowsPowerShell/v1.0/powershell.exe">
        <envs/>
        <method v="2"/>
    </configuration>
</component>

Which automatically inserts my windows user profile directory, even though default project directory is set to the following

image

and my test_script.ps1 is just

$a = Get-Location
Write-Output $a

which returns

image

if I try to set the work dir to its relative parent directory like so

image

I end up with a dir inside my pycharm installation directory image

However, it works as intended whenever I pass an absolute path image

If I try to manually define $PROJECT_DIR$: image

I end up with the following error image

So from what I can tell the leaving the working directory blank returns the user directory and relative paths are relative to a folder inside the pycharm installation folder.

Could it be a bug in pycharm or is there something that can be done in the plugin or is it simply me not understanding how it all connects? :)

Best Regards Kristoffer

Krande avatar Jun 04 '21 12:06 Krande