Start MemMapFS with a root directory.

This commit is contained in:
Steve Francia 2015-12-02 16:27:14 -05:00
parent f85f3b3779
commit 75dc847d59
1 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,10 @@ func (m *MemMapFs) runlock() { m.getMutex().RUnlock() }
func (m *MemMapFs) getData() map[string]File { func (m *MemMapFs) getData() map[string]File {
if m.data == nil { if m.data == nil {
m.data = make(map[string]File) m.data = make(map[string]File)
// Root should always exist, right?
// TODO: what about windows?
m.getData()["/"] = &InMemoryFile{name: "/", memDir: &MemDirMap{}, dir: true}
} }
return m.data return m.data
} }