Created
August 7, 2016 03:37
-
-
Save ahl/f99a75c90da8d44b61c6c78938f5438e to your computer and use it in GitHub Desktop.
nomsfs blog: mkdir.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (fs *nomsFS) mkdir(dir types.Struct, pathComponents []string) types.Struct { | |
if len(pathComponents) > 0 { | |
name := pathComponents[0] | |
return dir.Set(name, fs.mkdir(dir.Get(name).(types.Struct), pathComponents[1:])) | |
} else { | |
return types.NewStructWithType(directoryType, types.ValueSlice{types.NewMap()}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment