Function assumes that fileMap is locked for access
(dirpath string)
| 30 | |
| 31 | // Function assumes that fileMap is locked for access |
| 32 | func (f *fileIndex) CreateDirInFileMap(dirpath string) { |
| 33 | if dirpath == "/" { |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | pathParts := strings.Split(dirpath, "/") |
| 38 | |
| 39 | for i := len(pathParts); i > 1; i-- { |
| 40 | subPath := strings.Join(pathParts[:i], "/") |
| 41 | |
| 42 | if f.fileMap[subPath] == nil && subPath != "" { |
| 43 | f.fileMap[subPath] = &FileInformation{ |
| 44 | Name: subPath, |
| 45 | IsDirectory: true, |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // Function assumes that fileMap is locked for access |
| 52 | // TODO: This function is very expensive O(n), is there a better solution? |
no outgoing calls