vscode-deploy-reloaded icon indicating copy to clipboard operation
vscode-deploy-reloaded copied to clipboard

Symbolink links in packages are not followed under Windows

Open bgolinvaux opened this issue 5 years ago • 1 comments

Description

If I create an assets symbolic link inside my build folder and reference this build folder in a package section using:

        "files": [
          "build/**"
        ],

then the files in build/assets are not copied over to the target (local target in my case), and the assets folder is not created on the target.

The workaround is to do:

        "files": [
          "build/**"
          "build/assets/**"
        ],

Actual behavior

It seems that the symbolic links are not followed.

Expected behavior

I would expect symbolic links to be followed and the resulting hierarchy of my build folder to be copied to the destination.

Steps to reproduce

Open an admin console or enable Windows 10 Developer Mode (requires a recent version of Windows). Create, in a folder that is referenced in a deploy.reloaded package section, a directory symbolic link (not a hard link) that refers to some files outside of the build folder. Ensure the referenced folder contains items that are not filtered out by the exclude section.

You may use the following command to do so (in the folder one level above the build folder): cmd.exe /c "mklink /d build\assets ..\assets"

Deploy the target, and notice the files inside of the linked folder are not copied.

I am using the latest deploy.reloaded version as of 2020-01-22.

Example config

{
    "deploy.reloaded": {
      "packages": [
        {
          "name": "ovh_www_golinvaux",
          "description": "Whole site",
          "files": [
            "build/**"
            // "build/assets/**" // uncomment this line to enable the workaround
          ],
          "exclude": [
            "build/tests/**"
          ],
          "deployOnSave": true
        }
      ],
    "targets": [
      {
        "type": "local",
        "name": "local-ovh-www-golinvaux",
        "description": "golinvaux.com local deploy in C:\\temp",
        "mappings": {
          "build/**": "/"
        },
        "dir": "C:/temp/ovh_www_golinvaux",
        "empty": true,
        "checkBeforeDeploy": true
      }
    ]
  }
}

Logs

The logs do not mention anything about the assets symbolic link.

Screenshot

{Please write here, if possible}

Your environment

  • Operating system: {Please write here}
  • Visual Studio Code version: {Please write here}
  • Extension version: {Please write here}

Additional comments

Symbolic links are created with the mklink command (cmd.exe, not Powershell) and they can now be created by regular users (without admin rights), provided that the Developer Mode is enabled.

I understand that symbolic links are seldom used under Windows, but it seems that Microsoft is fixing things and is making sure they become first class citizens (they are now displayed and followed when using Explorer... however, when they are wrong, no error message is displayed, so it seems like a half-cooked feature at the moment). I am not sure about symlinks in tools like Hg or Git, though... (please note that they have been available in NTFS for approx. 10 years)

I take advantage of this issue report to thank you, Mr Kloubert, for all your amazing free vscode extensions that make our developer life much easier. Kudos!

bgolinvaux avatar Jan 22 '20 14:01 bgolinvaux

Maybe related: #108.

But personally I guess your situation is more difficult to deal with as it's a subfolder of deploy target, if I'm not mistaken?

If you're interested in contributing a patch, #139 could lead you to the relevant code.

Edit: on second thought, I don't think this relate to your issue that much, going to hide this comment.

zypA13510 avatar Feb 10 '20 17:02 zypA13510