GModCEFCodecFix
GModCEFCodecFix copied to clipboard
The first function should probably be generic over the path type, and the second becomes obsolete.
https://github.com/solsticegamestudios/GModCEFCodecFix/blob/d45a8690f9dff2e7097cf1dceb71815ace6cbab4/src/main.rs#L123-L153
fn path_to_canonical_pathbuf(path: impl AsRef<Path>, checkdirempty: bool) -> io::Result<PathBuf> {
let pathbuf = path.as_ref().canonicalize()?;
if checkdirempty && pathbuf_dir_not_empty(&pathbuf) {
return Err(io::Error::other("directory not empty"));
}
Ok(pathbuf)
}
String and str implement AsRef<Path>, so this function would work for that case as well.
ye