mirror of
https://github.com/zyllian/zyllian.github.io.git
synced 2025-01-18 11:47:01 -08:00
implement support for directories in the static file structure
This commit is contained in:
parent
d07eab6f37
commit
4d1d5308d3
1 changed files with 8 additions and 2 deletions
|
@ -95,10 +95,16 @@ impl<'a> SiteBuilder<'a> {
|
|||
|
||||
let root_path = self.site.site_path.join(ROOT_PATH);
|
||||
if root_path.exists() {
|
||||
for entry in root_path.read_dir()? {
|
||||
for entry in walkdir::WalkDir::new(&root_path) {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
std::fs::copy(&path, self.build_path.join(path.strip_prefix(&root_path)?))?;
|
||||
if path.is_dir() {
|
||||
continue;
|
||||
}
|
||||
let output_path = self.build_path.join(path.strip_prefix(&root_path)?);
|
||||
let parent_path = output_path.parent().expect("should never fail");
|
||||
std::fs::create_dir_all(parent_path)?;
|
||||
std::fs::copy(path, output_path)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue