| ... | ... | @@ -105,8 +105,8 @@ pub const LinuxDynLib = struct { |
| 105 | 105 | |
| 106 | 106 | /// Trusts the file |
| 107 | 107 | pub fn open(path: []const u8) !DynLib { |
| 108 | | const fd = try std.os.posixOpen(path, 0, linux.O_RDONLY | linux.O_CLOEXEC); |
| 109 | | errdefer std.os.close(fd); |
| 108 | const fd = try os.open(path, 0, os.O_RDONLY | os.O_CLOEXEC); |
| 109 | errdefer os.close(fd); |
| 110 | 110 | |
| 111 | 111 | const size = @intCast(usize, (try os.fstat(fd)).size); |
| 112 | 112 | |
| ... | ... | @@ -247,18 +247,10 @@ pub const WindowsDynLib = struct { |
| 247 | 247 | dll: windows.HMODULE, |
| 248 | 248 | |
| 249 | 249 | pub fn open(path: []const u8) !WindowsDynLib { |
| 250 | | const wpath = try win_util.sliceToPrefixedFileW(path); |
| 250 | const wpath = try windows.sliceToPrefixedFileW(path); |
| 251 | 251 | |
| 252 | 252 | return WindowsDynLib{ |
| 253 | | .dll = windows.LoadLibraryW(&wpath) orelse { |
| 254 | | const err = windows.GetLastError(); |
| 255 | | switch (err) { |
| 256 | | windows.ERROR.FILE_NOT_FOUND => return error.FileNotFound, |
| 257 | | windows.ERROR.PATH_NOT_FOUND => return error.FileNotFound, |
| 258 | | windows.ERROR.MOD_NOT_FOUND => return error.FileNotFound, |
| 259 | | else => return os.unexpectedErrorWindows(err), |
| 260 | | } |
| 261 | | }, |
| 253 | .dll = try windows.LoadLibraryW(&wpath), |
| 262 | 254 | }; |
| 263 | 255 | } |
| 264 | 256 | |