Path is too long fixed in Plastic SCM

Wednesday, October 12, 2016 , 0 Comments

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.

0 comentarios: