Path.GetFullPath(path); works fine. But Directory.CreateDirectory(path); throws a path too long exception. Can it be that the backslashes are counted differently for the two methods?
Path.GetFullPath(path); works fine. But Directory.CreateDirectory(path); throws a path too long exception. Can it be
Share
In ILSpy it seems that
GetFullPathuses theprivate const MaxDirectoryLength(255) whereasCreateDirectoryuses 248.Path.GetFullPath -> GetFullPathInternal -> NormalizePath
Directory.CreateDirectory -> InternalCreateDirectory (btw, NormalizePath is also called before InternalCreateDirectory)
So it seems that a folder name cannot be longer than 248 chars whereas the full path (incl. each subfolder) can be longer.