mirror of
https://github.com/zyllian/webdog.git
synced 2025-05-10 02:26:42 -07:00
Add Sass support
This commit is contained in:
parent
e06c4371f4
commit
5e1913c9de
9 changed files with 525 additions and 205 deletions
22
src/util.rs
Normal file
22
src/util.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
//! Module containing various utilities.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
/// Simple helper to remove the contents of a directory without removing the directory itself.
|
||||
pub fn remove_dir_contents(path: &Path) -> anyhow::Result<()> {
|
||||
if !path.exists() {
|
||||
std::fs::create_dir_all(path)?;
|
||||
return Ok(());
|
||||
}
|
||||
for entry in path.read_dir()? {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
if path.is_file() {
|
||||
std::fs::remove_file(&path)?;
|
||||
} else {
|
||||
std::fs::remove_dir_all(&path)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue