feat: port to Microsoft Windows
This commit is contained in:
@ -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)? {
|
||||
|
Reference in New Issue
Block a user