bugfix: RemoveAll

when i RemoveAll lib directory, it also Removed libs directory
This commit is contained in:
yearnfar 2021-11-15 00:13:11 +08:00
parent 949437f3b7
commit 061c13d75b
1 changed files with 1 additions and 1 deletions

View File

@ -279,7 +279,7 @@ func (m *MemMapFs) RemoveAll(path string) error {
defer m.mu.RUnlock() defer m.mu.RUnlock()
for p := range m.getData() { for p := range m.getData() {
if strings.HasPrefix(p, path) { if p == path || strings.HasPrefix(p, path+FilePathSeparator) {
m.mu.RUnlock() m.mu.RUnlock()
m.mu.Lock() m.mu.Lock()
delete(m.getData(), p) delete(m.getData(), p)