GModCEFCodecFix icon indicating copy to clipboard operation
GModCEFCodecFix copied to clipboard

The first function should probably be generic over the path type, and the second becomes obsolete.

Open JohnPeel opened this issue 9 months ago • 1 comments

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.

JohnPeel avatar Apr 02 '25 15:04 JohnPeel

ye

CherrieTheShifter avatar Nov 05 '25 20:11 CherrieTheShifter