summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNora <nora.widdecke@tu-bs.de>2019-06-09 15:52:42 +0200
committerNora <nora.widdecke@tu-bs.de>2019-06-09 15:52:42 +0200
commitab043d2e6482117fd2c3975b025f6f167cce2893 (patch)
treef211f84292f554cddb2c18b4e833d5c13ef253fa
parent72024042ae764d948c7e9ffae6833ef4c4c6aa6e (diff)
follow symlinks in all file accesses
-rw-r--r--src/actions/index/action.rs4
-rw-r--r--src/utils/fileutil.rs8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/actions/index/action.rs b/src/actions/index/action.rs
index ffbe4f8..b32a248 100644
--- a/src/actions/index/action.rs
+++ b/src/actions/index/action.rs
@@ -80,7 +80,9 @@ fn index_dir(dir: &Path, reindex: bool) -> KhResult<()> {
pub fn get_ics_files(dir: &Path, modified_since: i64) -> impl Iterator<Item = PathBuf> {
use walkdir::WalkDir;
- WalkDir::new(dir).into_iter()
+ WalkDir::new(dir)
+ .follow_links(true)
+ .into_iter()
.filter_entry(move |entry| accept_entry(entry, modified_since))
.filter_map(|e| e.ok())
.filter(|e| e.file_type().is_file())
diff --git a/src/utils/fileutil.rs b/src/utils/fileutil.rs
index 04d3796..a655f42 100644
--- a/src/utils/fileutil.rs
+++ b/src/utils/fileutil.rs
@@ -9,7 +9,9 @@ use crate::icalwrap::IcalVCalendar;
pub fn file_iter(dir: &Path) -> impl Iterator<Item = PathBuf> {
use walkdir::WalkDir;
- WalkDir::new(dir).into_iter()
+ WalkDir::new(dir)
+ .follow_links(true)
+ .into_iter()
.filter_map(|e| e.ok())
.filter(|e| e.file_type().is_file())
.map(|entry| entry.into_path())
@@ -19,7 +21,9 @@ pub fn dir_iter(dir: &Path) -> impl Iterator<Item = PathBuf> {
use walkdir::WalkDir;
let dir = dir.to_path_buf();
- WalkDir::new(&dir).into_iter()
+ WalkDir::new(&dir)
+ .follow_links(true)
+ .into_iter()
.filter_map(|e| e.ok())
.filter(|e| e.file_type().is_dir())
.filter(move |f| f.path() != dir)