Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action file paths being incorrectly "fixed" with forward slashes in MSVS #177

Open
alexciarlillo opened this issue Sep 8, 2022 · 0 comments
Labels

Comments

@alexciarlillo
Copy link

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 &amp;&amp; copy &quot;C:/Users/alexc/code/redacted/client/www/electron/native/build/$(Configuration)/binary.exe&quot; &quot;C:/Users/alexc/code/redacted/client/www/electron/build_app/binary_$(PlatformShortName).exe&quot;&#xD;&#xA;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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants