I'm trying to create a function that takes the name of a directory (`C:\foo\bar`, or `..\foo\bar\..\baz`, or `\\someserver\foo\bar`), and creates directories as necessary so that the whole path is created.

I am attempting a pretty naive implementation of this myself and it seems to be a string processing nightmare. There is `/` vs `\`, there is the special case of network shares which begin with `\\` (also you can't attempt to mkdir() the first two levels of the path which are machine name and share name), and there is `\.\` type nonsense that can exist in a path.

Does there exist a simple way to do this in C++?