Action file paths being incorrectly "fixed" with forward slashes in MSVS
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 155
- Forks
- 101
- Avg merge
- 6d 2h
- Merged PRs (30d)
- 4
Description
I believe this was caused by #121
A copy action like the following results in a forward slashed path for the copy command, and the system complains it cannot find the file specified:
{
"target_name": "copy_binary",
"type":"none",
"dependencies" : [ "build_binary"],
'actions': [
{
'action_name': 'copy_binary',
'inputs': ['<(module_root_dir)/build/<(CONFIGURATION_NAME)/binary.exe'],
'outputs': ['<(module_root_dir)/../build_app/binary_$(PlatformShortName).exe'],
'action': ['SET COPYCMD=/Y && copy', '<@(_inputs)', '<@(_outputs)'],
}
]
}
In the vcproj we can see:
<CustomBuild Include="C:\Users\alexc\code\redacted\client\www\electron\native\build\$(ConfigurationName)\binary.exe">
<FileType>Document</FileType>
<Command>call call SET COPYCMD=\Y && copy "C:/Users/alexc/code/redacted/client/www/electron/native/build/$(Configuration)/binary.exe" "C:/Users/alexc/code/redacted/client/www/electron/build_app/binary_$(PlatformShortName).exe"
if %errorlevel% neq 0 exit /b %errorlevel%</Command>
<Message>copy_binary</Message>
<Outputs>C:\Users\alexc\code\redacted\client\www\electron\build_app\binary_$(PlatformShortName).exe</Outputs>
</CustomBuild>
To me, reading the comment here does not match the added code:
# If the argument starts with a slash or dash, it's probably a command line
# switch
# Return the path with forward slashes because the command using it might
# not support backslashes.
arguments = [i if (i[:1] in "/-") else _FixPath(i, "/") for i in cmd[1:]]
I believe it should be something like:
arguments = [_FixPath(i, "/") if (i[:1] in "/-") else _FixPath(i) for i in cmd[1:]]
OR don't call FixPath at all if it's not a command line switch and enforce backslashes be used directly in the inputs/outputs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Python argument-handling code containing the shown _FixPath call and compare it with the behavior introduced by #121. Reproduce the MSVS copy action, then verify that the generated copy command uses Windows-compatible paths and that the resulting vcproj action can find the input and output files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100