mirror of https://github.com/dahall/Vanara.git
Create WinBase.File.cs (#213)
MAX_PATH is not a hard limit on the maximum length of a file path. Using Windows 10, I have a file path that is ~378 chars long, and an exception is thrown in the local method AddCap because the code attempts to increase the size of the StringBuilder beyond the 261 chars that was specified in the constructor. This change just removes the hard upper limit cap on that length.pull/217/head
parent
d7eeb1ca06
commit
63f7a1d201
|
@ -3177,7 +3177,7 @@ namespace Vanara.PInvoke
|
||||||
/// <returns>List of strings returned by <paramref name="first"/> and <paramref name="next"/> methods.</returns>
|
/// <returns>List of strings returned by <paramref name="first"/> and <paramref name="next"/> methods.</returns>
|
||||||
private static IEnumerable<string> EnumFindMethods<THandle>(FindFirstDelegate<THandle> first, FindNextDelegate<THandle> next, uint strSz = MAX_PATH + 1, uint done = Win32Error.ERROR_HANDLE_EOF) where THandle : SafeHandle
|
private static IEnumerable<string> EnumFindMethods<THandle>(FindFirstDelegate<THandle> first, FindNextDelegate<THandle> next, uint strSz = MAX_PATH + 1, uint done = Win32Error.ERROR_HANDLE_EOF) where THandle : SafeHandle
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder((int)strSz, (int)strSz);
|
var sb = new StringBuilder((int)strSz);
|
||||||
THandle h;
|
THandle h;
|
||||||
while ((h = first(sb, ref strSz)).IsInvalid)
|
while ((h = first(sb, ref strSz)).IsInvalid)
|
||||||
{
|
{
|
||||||
|
@ -5153,4 +5153,4 @@ namespace Vanara.PInvoke
|
||||||
protected override bool InternalReleaseHandle() => FindVolumeMountPointClose(handle);
|
protected override bool InternalReleaseHandle() => FindVolumeMountPointClose(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue