summaryrefslogtreecommitdiff
path: root/internal/nametransform/diriv.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/nametransform/diriv.go')
-rw-r--r--internal/nametransform/diriv.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/nametransform/diriv.go b/internal/nametransform/diriv.go
index 6746f04..87e7887 100644
--- a/internal/nametransform/diriv.go
+++ b/internal/nametransform/diriv.go
@@ -162,3 +162,12 @@ func (be *NameTransform) EncryptPathDirIV(plainPath string, rootDir string) (cip
be.DirIVCache.Store(parentDir, iv, cParentDir)
return cipherPath, nil
}
+
+// Dir is like filepath.Dir but returns "" instead of ".".
+func Dir(path string) string {
+ d := filepath.Dir(path)
+ if d == "." {
+ return ""
+ }
+ return d
+}