aboutsummaryrefslogtreecommitdiff
path: root/filesystem/path.go
diff options
context:
space:
mode:
Diffstat (limited to 'filesystem/path.go')
-rw-r--r--filesystem/path.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/filesystem/path.go b/filesystem/path.go
index 3be1859..d788a6b 100644
--- a/filesystem/path.go
+++ b/filesystem/path.go
@@ -23,6 +23,8 @@ import (
"log"
"os"
"path/filepath"
+
+ "github.com/pkg/errors"
)
// We only check the unix permissions and the sticky bit
@@ -34,8 +36,14 @@ func cannonicalizePath(path string) (string, error) {
if err != nil {
return "", err
}
+ path, err = filepath.EvalSymlinks(path)
+
+ // Get a better error if we have an invalid path
+ if pathErr, ok := err.(*os.PathError); ok {
+ err = errors.Wrap(pathErr.Err, pathErr.Path)
+ }
- return filepath.EvalSymlinks(path)
+ return path, err
}
// loggedStat runs os.Stat, but it logs the error if stat returns any error