risc0 / zeth

A "Type 0" zkEVM. Prove validity of Ethereum blocks using RISC Zero's zkVM
Apache License 2.0
356 stars 65 forks source link

fix: use PathBuf instead of String to compatible different platforms and non-Unicode sequences in filepath #65

Closed dyxushuai closed 9 months ago

dyxushuai commented 9 months ago

The different between platforms: ^1

The need for this type arises from the fact that:

1. On Unix systems, strings are often arbitrary sequences of non-zero bytes, in many cases interpreted as UTF-8.

2. On Windows, strings are often arbitrary sequences of non-zero 16-bit values, interpreted as UTF-16 when it is valid to do so.

3. In Rust, strings are always valid UTF-8, which may contain zeros.

Non-Unicode sequences: ^2

use std::path::Path;

let path = Path::new("foo.txt");
assert_eq!(path.to_string_lossy(), "foo.txt");
// "fo�.txt"
dyxushuai commented 9 months ago

@Wollac needs your review

Wollac commented 9 months ago

I agree that PathBuf is the cleaner way to go here. So let's fix the remaining issues to get this merged.

dyxushuai commented 9 months ago

I agree that PathBuf is the cleaner way to go here. So let's fix the remaining issues to get this merged.

Already fixed all tests and rebase to the newest main branch, @Wollac pls give another look.