8232092: (fs) Files::isWritable returns false on a writeable root directory (win)

Reviewed-by: alanb
This commit is contained in:
Nhat Nguyen 2020-10-07 19:45:20 +00:00 committed by Alan Bateman
parent 5a9bd41e79
commit abe2593772
2 changed files with 483 additions and 1 deletions

View file

@ -82,7 +82,12 @@ class WindowsFileStore
try {
return createFromPath(target);
} catch (WindowsException e) {
if (e.lastError() != ERROR_DIR_NOT_ROOT)
// GetVolumePathName might return the following error codes
// when the drives were created using `subst`.
// Try expanding the path again in such cases.
if (e.lastError() != ERROR_DIR_NOT_ROOT &&
e.lastError() != ERROR_INVALID_PARAMETER &&
e.lastError() != ERROR_DIRECTORY)
throw e;
target = WindowsLinkSupport.getFinalPath(file);
if (target == null)