authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-08-17 23:29:53-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-18 18:07:16-07:00
loge078324dbe2b57a4016d91b2d2cca0bfc3ef82aa
tree4c5d9fe7120500bc8a27f59e62a1d6c622b3509a
parent84b4b6bffa126f1491f6029286ddecb5d6aec74b

Add NetworkNotFound to ReadLinkError

This matches how other filesystem functions were made to handle BAD_NETWORK_PATH/BAD_NETWORK_NAME in https://github.com/ziglang/zig/pull/16568. ReadLink was the odd one out, but that is no longer the case.

3 files changed, 6 insertions(+), 3 deletions(-)

lib/std/os.zig+2
...@@ -2995,6 +2995,8 @@ pub const ReadLinkError = error{...@@ -2995,6 +2995,8 @@ pub const ReadLinkError = error{
2995 /// Windows-only. This error may occur if the opened reparse point is2995 /// Windows-only. This error may occur if the opened reparse point is
2996 /// of unsupported type.2996 /// of unsupported type.
2997 UnsupportedReparsePointType,2997 UnsupportedReparsePointType,
2998 /// On Windows, `\\server` or `\\server\share` was not found.
2999 NetworkNotFound,
2998} || UnexpectedError;3000} || UnexpectedError;
29993001
3000/// Read value of a symbolic link.3002/// Read value of a symbolic link.
lib/std/os/windows.zig+3-3
...@@ -803,6 +803,7 @@ pub fn CreateSymbolicLink(...@@ -803,6 +803,7 @@ pub fn CreateSymbolicLink(
803803
804pub const ReadLinkError = error{804pub const ReadLinkError = error{
805 FileNotFound,805 FileNotFound,
806 NetworkNotFound,
806 AccessDenied,807 AccessDenied,
807 Unexpected,808 Unexpected,
808 NameTooLong,809 NameTooLong,
...@@ -850,9 +851,8 @@ pub fn ReadLink(dir: ?HANDLE, sub_path_w: []const u16, out_buffer: []u8) ReadLin...@@ -850,9 +851,8 @@ pub fn ReadLink(dir: ?HANDLE, sub_path_w: []const u16, out_buffer: []u8) ReadLin
850 .OBJECT_NAME_NOT_FOUND => return error.FileNotFound,851 .OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
851 .OBJECT_PATH_NOT_FOUND => return error.FileNotFound,852 .OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
852 .NO_MEDIA_IN_DEVICE => return error.FileNotFound,853 .NO_MEDIA_IN_DEVICE => return error.FileNotFound,
853 // TODO: Should BAD_NETWORK_* be translated to a different error?854 .BAD_NETWORK_PATH => return error.NetworkNotFound, // \\server was not found
854 .BAD_NETWORK_PATH => return error.FileNotFound, // \\server was not found855 .BAD_NETWORK_NAME => return error.NetworkNotFound, // \\server was found but \\server\share wasn't
855 .BAD_NETWORK_NAME => return error.FileNotFound, // \\server was found but \\server\share wasn't
856 .INVALID_PARAMETER => unreachable,856 .INVALID_PARAMETER => unreachable,
857 .SHARING_VIOLATION => return error.AccessDenied,857 .SHARING_VIOLATION => return error.AccessDenied,
858 .ACCESS_DENIED => return error.AccessDenied,858 .ACCESS_DENIED => return error.AccessDenied,
lib/std/zig/system/NativeTargetInfo.zig+1
...@@ -833,6 +833,7 @@ pub fn abiAndDynamicLinkerFromFile(...@@ -833,6 +833,7 @@ pub fn abiAndDynamicLinkerFromFile(
833 error.InvalidUtf8 => unreachable, // Windows only833 error.InvalidUtf8 => unreachable, // Windows only
834 error.BadPathName => unreachable, // Windows only834 error.BadPathName => unreachable, // Windows only
835 error.UnsupportedReparsePointType => unreachable, // Windows only835 error.UnsupportedReparsePointType => unreachable, // Windows only
836 error.NetworkNotFound => unreachable, // Windows only
836837
837 error.AccessDenied,838 error.AccessDenied,
838 error.FileNotFound,839 error.FileNotFound,