Who we are

We are the developers of Plastic SCM, a full version control stack (not a Git variant). We work on the strongest branching and merging you can find, and a core that doesn't cringe with huge binaries and repos. We also develop the GUIs, mergetools and everything needed to give you the full version control stack.

If you want to give it a try, download it from here.

We also code SemanticMerge, and the gmaster Git client.

Path is too long fixed in Plastic SCM

Wednesday, October 12, 2016 Ma Nu , 0 Comments

UPDATE 2018/01/31: If the main fix explained below doesn't work for you check the edit at the bottom in order to learn how to change the plastic.exe manifest, this method succeeds where the main one fails.
UPDATE 2019/01/29: If you use Windows 10 Home you might need to follow the steps explained here: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

Ever faced the following issue while dealing with long paths in Windows?
Good news! Microsoft has released the .NET 4.6.2 framework and it fixes the “path is too long” error.
Applications using the Win32 framework will also take advantage of this new feature but you will need to tweak a couple of settings to make it work, since Microsoft didn’t enable it by default.
This blogpost explains how to set up your machine to get the issue fixed.

Group policy

The fastest way to enable the feature is changing a Microsoft 10 Group Policy.
  • Open the Local Group Policy editor by running “gpedit.msc”
  • Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem
  • Right click “Enable Win32 long paths”
  • Enable it
Notice how the policy description states only manifested applications will be allowed to access paths beyond the normal 260-character limit.
We need to change the way in which Plastic SCM is executed to enjoy the new long paths support.
Plastic SCM has two different applications: “plastic.exe” and “cm.exe”. We need to change their manifest configuration files to enable long paths on both GUI and CLI.

cm.exe.config

Without changing the application manifest we’ll still hit the limitation:
C:\Users\manu>cm mkwk wkdefault C:\tmp\4567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\hey
Error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
So edit the c:\Program Files\PlasticSCM5\client\cm.exe.config file and add the AppContextSwitchOverrides entry you can read below, the resulting file must look like the following one:

After saving the changes we are good to go and start using long paths inside the cm.exe tool:
C:\Users\manu>cm mkwk wkdefault C:\tmp\4567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\hey
Workspace wkdefault has been correctly created

plastic.exe.config

Same must be done for the GUI, the c:\Program Files\PlasticSCM5\client\plastic.exe.config file has to be changed in exactly the same way as the cm.exe.config file.
That's all! Now creating workspaces using very long paths and updating their content shouldn't be a problem anymore.

(2018/01/31)Change the plastic.manifest

Extract the manifest from plastic.exe using mt.exe.
mt.exe -inputresource:plastic.exe -out:plastic.manifest
plastic.manifest looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"></assemblyIdentity>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
Change it as seen below, based on this post
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"></assemblyIdentity>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>

  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
      <longPathAware>true</longPathAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>
Embed the manifest back in plastic.exe and cm.exe using:
mt.exe -manifest plastic.manifest -outputresource:plastic.exe
That's all!
Manuel Lucio
I'm in charge of the Customer Support area.
I deal with complex setups, policies and working methodologies on a daily basis.
Prior to taking full responsibility of support, I worked as software engineer. I have been in charge of load testing for quite some time, so if you want to know how well Plastic compares to SVN or P4 under a really heavy load, I'm your guy.
I like to play with Arduino GPS devices, mountain biking and playing tennis.
You can find me hooked to my iPhone, skate-boarding or learning Korean... and also here @mrcatacroquer.

0 comentarios: