forked from mirror/afero
bugfix: RemoveAll
when i RemoveAll lib directory, it also Removed libs directory
This commit is contained in:
parent
949437f3b7
commit
061c13d75b
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue