e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
126 lines
3.7 KiB
Plaintext
126 lines
3.7 KiB
Plaintext
fn __zero_std_fs_read_file(fs: Fs, path: String, buffer: MutSpan<u8>) -> Maybe<usize> {
|
|
let opened: Maybe<owned<File>> = std.fs.open(fs, path)
|
|
if opened.has {
|
|
var file: owned<File> = opened.value
|
|
var total: usize = 0
|
|
var ok: Bool = true
|
|
var done: Bool = false
|
|
while ok && !done && total < std.mem.len(buffer) {
|
|
let count: Maybe<usize> = std.fs.read(&mut file, buffer[total..])
|
|
if !count.has {
|
|
ok = false
|
|
} else if count.value == 0 {
|
|
done = true
|
|
} else {
|
|
total = total + count.value
|
|
}
|
|
}
|
|
var extra: [64]u8 = [0_u8; 64]
|
|
while ok && !done {
|
|
let count: Maybe<usize> = std.fs.read(&mut file, extra)
|
|
if !count.has {
|
|
ok = false
|
|
} else if count.value == 0 {
|
|
done = true
|
|
} else {
|
|
total = total + count.value
|
|
}
|
|
}
|
|
std.fs.close(&mut file)
|
|
if ok {
|
|
return total
|
|
}
|
|
return null
|
|
}
|
|
return null
|
|
}
|
|
|
|
fn __zero_std_fs_write_file(fs: Fs, path: String, bytes: Span<u8>) -> Bool {
|
|
let count: Maybe<usize> = std.fs.writeBytes(path, bytes)
|
|
return count.has && count.value == std.mem.len(bytes)
|
|
}
|
|
|
|
fn __zero_std_fs_append_file(fs: Fs, path: String, bytes: Span<u8>) -> Bool {
|
|
let count: Maybe<usize> = std.fs.appendBytes(path, bytes)
|
|
return count.has && count.value == std.mem.len(bytes)
|
|
}
|
|
|
|
fn __zero_std_fs_copy_file(from_path: String, to_path: String, buffer: MutSpan<u8>) -> Bool {
|
|
if std.mem.len(buffer) == 0 {
|
|
return false
|
|
}
|
|
let fs: Fs = std.fs.host()
|
|
let opened: Maybe<owned<File>> = std.fs.open(fs, from_path)
|
|
if !opened.has {
|
|
return false
|
|
}
|
|
var src: owned<File> = opened.value
|
|
let created: Maybe<owned<File>> = std.fs.create(fs, to_path)
|
|
if !created.has {
|
|
std.fs.close(&mut src)
|
|
return false
|
|
}
|
|
var dst: owned<File> = created.value
|
|
var ok: Bool = true
|
|
var done: Bool = false
|
|
while ok && !done {
|
|
let count: Maybe<usize> = std.fs.read(&mut src, buffer)
|
|
if !count.has {
|
|
ok = false
|
|
} else if count.value == 0 {
|
|
done = true
|
|
} else {
|
|
let chunk: Span<u8> = buffer[..count.value]
|
|
if !std.fs.writeAll(&mut dst, chunk) {
|
|
ok = false
|
|
}
|
|
}
|
|
}
|
|
std.fs.close(&mut src)
|
|
std.fs.close(&mut dst)
|
|
return ok
|
|
}
|
|
|
|
fn __zero_std_fs_file_size(fs: Fs, path: String) -> Maybe<usize> {
|
|
let opened: Maybe<owned<File>> = std.fs.open(fs, path)
|
|
if opened.has {
|
|
var file: owned<File> = opened.value
|
|
let len: Maybe<usize> = std.fs.fileLen(&mut file)
|
|
std.fs.close(&mut file)
|
|
return len
|
|
}
|
|
return null
|
|
}
|
|
|
|
fn __zero_std_fs_is_file(path: String) -> Bool {
|
|
if std.fs.isDir(path) {
|
|
return false
|
|
}
|
|
let fs: Fs = std.fs.host()
|
|
let size: Maybe<usize> = std.fs.fileSize(fs, path)
|
|
return size.has
|
|
}
|
|
|
|
fn __zero_std_fs_ensure_dir(path: String) -> Bool {
|
|
if std.fs.isDir(path) {
|
|
return true
|
|
}
|
|
return std.fs.makeDir(path)
|
|
}
|
|
|
|
fn __zero_std_fs_read_file_bytes(fs: Fs, path: String, buffer: MutSpan<u8>) -> Maybe<Span<u8>> {
|
|
let count: Maybe<usize> = std.fs.readBytes(path, buffer)
|
|
if count.has && count.value <= std.mem.len(buffer) {
|
|
return buffer[..count.value]
|
|
}
|
|
return null
|
|
}
|
|
|
|
fn __zero_std_fs_read_file_equals(fs: Fs, path: String, buffer: MutSpan<u8>, expected: Span<u8>) -> Bool {
|
|
let bytes: Maybe<Span<u8>> = std.fs.readFileBytes(fs, path, buffer)
|
|
if bytes.has {
|
|
return std.mem.eqlBytes(bytes.value, expected)
|
|
}
|
|
return false
|
|
}
|