Repository: brocode/fw (language: rust)

Issue:
fw fails parsing config on Mac devices when .DS_Store files are present
The message unfortunately is not very clear on what the issue is:
```
Aug 17 14:42:12.337 WARN Could not read v2.0 config: Err(Io(Error { kind: InvalidData, message: "stream did not contain valid UTF-8" })). If you are running the setup right now this is expected., module: fw:22
Aug 17 14:42:12.337 CRIT Error running command, error: Io(Error { kind: InvalidData, message: "stream did not contain valid UTF-8" }), command: ls, module: fw:172
```

The best solution would be to ignore `.DS_Store` files entirely.
I will line up a PR.




Discussion / hints:

Fix patch:
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 5f7163e8..a8f32503 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -38,9 +38,16 @@ pub fn read_config(logger: &Logger) -> Result<Config, AppError> {
   if paths.projects.exists() {
     for maybe_project_file in WalkDir::new(&paths.projects).follow_links(true) {
       let project_file = maybe_project_file?;
-      if project_file.metadata()?.is_file() {
+      if project_file.metadata()?.is_file() && !project_file.file_name().to_os_string().eq(".DS_Store") {
         let raw_project = read_to_string(project_file.path())?;
-        let mut project: Project = toml::from_str(&raw_project)?;
+        let mut project: Project = match toml::from_str(&raw_project) {
+          o @ Ok(_) => o,
+          e @ Err(_) => {
+            eprintln!("There is an issue in your config for project {}", project_file.file_name().to_string_lossy());
+            e
+          }
+        }?;
+
         project.name = project_file
           .file_name()
           .to_str()
@@ -67,7 +74,8 @@ pub fn read_config(logger: &Logger) -> Result<Config, AppError> {
   if paths.tags.exists() {
     for maybe_tag_file in WalkDir::new(&paths.tags).follow_links(true) {
       let tag_file = maybe_tag_file?;
-      if tag_file.metadata()?.is_file() {
+
+      if tag_file.metadata()?.is_file() && !tag_file.file_name().to_os_string().eq(".DS_Store") {
         let raw_tag = read_to_string(tag_file.path())?;
         let mut tag: Tag = toml::from_str(&raw_tag)?;
         let tag_name: String = tag_file


Test patch: