mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-06 05:44:11 +08:00
去掉getEndPos使用lseek,因为getEndPos需要用statx,这个在debian10没有……
This commit is contained in:
parent
dbb4c28ffe
commit
e17f8a4dd6
@ -120,9 +120,14 @@ pub fn main() !void {
|
||||
}
|
||||
|
||||
fn readAll(allocator: Allocator, file: File) ![]u8 {
|
||||
const file_size: usize = @intCast(try file.getEndPos());
|
||||
//const file_size: usize = @intCast(try file.getEndPos());
|
||||
//const file_contents = try allocator.alloc(u8, file_size);
|
||||
try file.seekFromEnd(0);
|
||||
const file_size = try file.getPos();
|
||||
const file_contents = try allocator.alloc(u8, file_size);
|
||||
|
||||
try file.seekTo(0);
|
||||
|
||||
const readed = try file.readAll(file_contents);
|
||||
if (readed != file_size) {
|
||||
return error.EndOfStream;
|
||||
|
Loading…
x
Reference in New Issue
Block a user