feat: port to Microsoft Windows

This commit is contained in:
2025-02-23 18:12:20 +00:00
parent a29bce2227
commit caead1e70f
12 changed files with 145 additions and 26 deletions

View File

@ -1,3 +1,4 @@
use anyhow::{anyhow, Result};
use directories::ProjectDirs;
use std::path::{Path, PathBuf};
@ -31,6 +32,11 @@ pub fn cache_dir() -> PathBuf {
get_dirs().cache_dir().to_owned()
}
pub fn path_to_str(p: impl AsRef<Path>) -> Result<String> {
Ok(p.as_ref().to_str()
.ok_or_else(|| anyhow!("Invalid path: {}", p.as_ref().to_string_lossy()))?.to_owned())
}
pub fn copy_recursive(src: &Path, dst: &Path) -> std::io::Result<()> {
std::fs::create_dir_all(&dst).unwrap();
for entry in std::fs::read_dir(src)? {