Skip to content

Commit

Permalink
macos: don't throw IO errors because of .DS_Store files
Browse files Browse the repository at this point in the history
MacOS creates lots of these files, and if the directory is otherwise
empty, we would throw an IO error to the unsuspecting user.

With this patch, we log a warning, but otherwise pretend we did not
see it.

Mitigates #140
  • Loading branch information
rfjakob committed Sep 5, 2017
1 parent 538cae6 commit 3a5a783
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/fusefrontend/fs_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"os"
"path/filepath"
"runtime"
"sync"
"syscall"

Expand Down Expand Up @@ -324,6 +325,11 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f
if err != nil {
tlog.Warn.Printf("OpenDir %q: invalid entry %q: %v",
cDirName, cName, err)
if runtime.GOOS == "darwin" && cName == ".DS_Store" {
// MacOS creates lots of these files. Log the warning but don't
// increment errorCount - does not warrant returning EIO.
continue
}
errorCount++
continue
}
Expand Down

0 comments on commit 3a5a783

Please sign in to comment.