As mentioned in GoDocs, os.Create()
creates a file in specific path.
os.Create("fonts/foo/font.eot")
But when fonts
or foo
doesn't exists, it returns panic: open fonts/foo/font.eot: The system cannot find the path specified.
So i used os.MkdirAll()
to create nested directory. But there are many other problems with this function.
path := "fonts/foo/font.eot"
// this line create a directory named (font.eot) !
os.MkdirAll(path, os.ModePerm)
Is there any better way to create a file in nested directories?