Open blassmegod opened 4 years ago
If I understand you correctly .\folder\script.cmd will get replaced to ./folder/script.cmd. But this shouldn't make a difference or did you get an error?
I'm absolute agree with you and that relative paths are useful. I really don't see the connection to the replacement of the slash with a backslash.
It says that it cannot find ".", but if you use backslash then it's extecuting the script. This is because of how cmd.exe parses the commands and Windows paths. So even if in Windows Explorer you can use slash or backslash in cmd.exe it might have different meaning.
This is actually related to my merge request on getting relative paths to work. I am trying to remember as it has been some time now, but there were issues where the script could not get run if it was using \
for some reason.
@blassmegod I do not see any issue after looking at the code. You do NOT want to put the period in the Script text field. Use the absolute path in the text field, and the plugin will automagically use relative paths if the absolute path given is inside the project. When the script is located in the working directory, then only give the name of the script file in the Script text input, and then the path to the script in the working directory text input (as shown):
Because in this case the project folder is C:\Users\tlfal_000\Desktop\outside
the script will be run as .\dist\server_dist\run_server.bat
EDIT: You can confirm this by looking at the idea run config that is created for the task:
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="run_server" type="BatchConfigurationType" factoryName="Batch">
<module name="outside" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/dist/server_dist" />
<option name="PARENT_ENVS" value="true" />
<option name="SCRIPT_NAME" value="run_server.bat" />
<option name="PARAMETERS" value="" />
<method v="2" />
</configuration>
</component>
Take note of the use of `$PROJECT_DIR$ to make the path relative to the project.
Would be nice that the "Script" input would not replace "\" with "/" character, so that for example a relative script can be used like ".\folder\script.cmd". This is useful when using "Working directory" to set the directory from where to run the command, also for scripts that expect to be executed from a parent folder. Also it's a little bit strange that a Windows plugin enforces Linux/Unix file path separator.