From 061c13d75ba8fafdeb5d3e3cd1c1fe0ba19a0f3f Mon Sep 17 00:00:00 2001 From: yearnfar Date: Mon, 15 Nov 2021 00:13:11 +0800 Subject: [PATCH] bugfix: RemoveAll when i RemoveAll lib directory, it also Removed libs directory --- memmap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memmap.go b/memmap.go index 5c265f9..ea0798d 100644 --- a/memmap.go +++ b/memmap.go @@ -279,7 +279,7 @@ func (m *MemMapFs) RemoveAll(path string) error { defer m.mu.RUnlock() for p := range m.getData() { - if strings.HasPrefix(p, path) { + if p == path || strings.HasPrefix(p, path+FilePathSeparator) { m.mu.RUnlock() m.mu.Lock() delete(m.getData(), p)