Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always follow symlinks #1883

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/content/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn has_anchor(headings: &[Heading], anchor: &str) -> bool {
pub fn find_related_assets(path: &Path, config: &Config, recursive: bool) -> Vec<PathBuf> {
let mut assets = vec![];

let mut builder = WalkDir::new(path);
let mut builder = WalkDir::new(path).follow_links(true);
if !recursive {
builder = builder.max_depth(1);
}
Expand Down
4 changes: 3 additions & 1 deletion components/site/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ impl Site {
// not the most elegant loop, but this is necessary to use skip_current_dir
// which we can only decide to use after we've deserialised the section
// so it's kinda necessecary
let mut dir_walker = WalkDir::new(format!("{}/{}", base_path, "content/")).into_iter();
let mut dir_walker =
WalkDir::new(format!("{}/{}", base_path, "content/")).follow_links(true).into_iter();
let mut allowed_index_filenames: Vec<_> = self
.config
.other_languages()
Expand Down Expand Up @@ -220,6 +221,7 @@ impl Site {
// index files for all languages and process them simultaniously
// before any of the pages
let index_files = WalkDir::new(&path)
.follow_links(true)
.max_depth(1)
.into_iter()
.filter_map(|e| match e {
Expand Down
4 changes: 3 additions & 1 deletion components/utils/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ pub fn copy_file_if_needed(src: &Path, dest: &Path, hard_link: bool) -> Result<(
}

pub fn copy_directory(src: &Path, dest: &Path, hard_link: bool) -> Result<()> {
for entry in WalkDir::new(src).into_iter().filter_map(std::result::Result::ok) {
for entry in
WalkDir::new(src).follow_links(true).into_iter().filter_map(std::result::Result::ok)
{
let relative_path = entry.path().strip_prefix(src).unwrap();
let target_path = dest.join(relative_path);

Expand Down