peteraritchie / LongPath

drop-in library to support long paths in .NET
GNU Lesser General Public License v3.0
112 stars 43 forks source link

The filename or extension is too long when creating a Directory on UNC #79

Open emilecastelnuovo opened 5 years ago

emilecastelnuovo commented 5 years ago

Using latest NuGet package: Pri.LongPath 2.0.47

When trying to create a Directory on a UNC path I get this error if the directory name contains an "extension" too long. For example: Directory.Create("\\sntsmb01\ApplicationSupport\Sviluppo\Deploy_Working\RIP_09733_ChangeManagement_PR10125.IT\-20190426_01_Emile.Xxxxxxxxxxx\Cccccccccc\SmartClient\wwwroot_APPZ[SC] Cccccccccc.LimitsBuilder.2\Application Files\Xxxxxxx.Bre.Xxxxxx.Builder_4_5_0_214 ");

Workaround: Create a fake Dir adding a fake extension like ".a" and then rename it using Directory.Move(fakeName, realName)

Stack Trace: System.IO.PathTooLongException: The filename or extension is too long.

at Pri.LongPath.Directory.CreateDirectoryUnc(String path) at Pri.LongPath.Directory.CreateDirectory(String path)