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{
29952995 /// Windows-only. This error may occur if the opened reparse point is
29962996 /// of unsupported type.
29972997 UnsupportedReparsePointType,
2998 /// On Windows, `\\server` or `\\server\share` was not found.
2999 NetworkNotFound,
29983000} || UnexpectedError;
29993001
30003002/// Read value of a symbolic link.
lib/std/os/windows.zig+3-3
......@@ -803,6 +803,7 @@ pub fn CreateSymbolicLink(
803803
804804pub const ReadLinkError = error{
805805 FileNotFound,
806 NetworkNotFound,
806807 AccessDenied,
807808 Unexpected,
808809 NameTooLong,
......@@ -850,9 +851,8 @@ pub fn ReadLink(dir: ?HANDLE, sub_path_w: []const u16, out_buffer: []u8) ReadLin
850851 .OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
851852 .OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
852853 .NO_MEDIA_IN_DEVICE => return error.FileNotFound,
853 // TODO: Should BAD_NETWORK_* be translated to a different error?
854 .BAD_NETWORK_PATH => return error.FileNotFound, // \\server was not found
855 .BAD_NETWORK_NAME => return error.FileNotFound, // \\server was found but \\server\share wasn't
854 .BAD_NETWORK_PATH => return error.NetworkNotFound, // \\server was not found
855 .BAD_NETWORK_NAME => return error.NetworkNotFound, // \\server was found but \\server\share wasn't
856856 .INVALID_PARAMETER => unreachable,
857857 .SHARING_VIOLATION => return error.AccessDenied,
858858 .ACCESS_DENIED => return error.AccessDenied,
lib/std/zig/system/NativeTargetInfo.zig+1
......@@ -833,6 +833,7 @@ pub fn abiAndDynamicLinkerFromFile(
833833 error.InvalidUtf8 => unreachable, // Windows only
834834 error.BadPathName => unreachable, // Windows only
835835 error.UnsupportedReparsePointType => unreachable, // Windows only
836 error.NetworkNotFound => unreachable, // Windows only
836837
837838 error.AccessDenied,
838839 error.FileNotFound,