style nit

This commit is contained in:
Mitchell Hashimoto
2024-02-12 19:31:58 -08:00
parent 28ff9f7310
commit 9193cfa6d2

View File

@ -76,11 +76,15 @@ pub const LoadingImage = struct {
return error.InvalidData;
};
if (builtin.os != .windows and std.mem.indexOfScalar(u8, buf[0..size], 0) == null) {
// std.os.realpath *asserts* that the path does not have internal nulls instead of erroring.
log.warn("failed to get absolute path: BadPathName", .{});
return error.InvalidData;
if (comptime builtin.os != .windows) {
if (std.mem.indexOfScalar(u8, buf[0..size], 0) == null) {
// std.os.realpath *asserts* that the path does not have
// internal nulls instead of erroring.
log.warn("failed to get absolute path: BadPathName", .{});
return error.InvalidData;
}
}
var abs_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const path = std.os.realpath(buf[0..size], &abs_buf) catch |err| {
log.warn("failed to get absolute path: {}", .{err});