Open
Description
Currently create_dir_all
first does a stat on the file to see if it is a directory, and if not tries to create the parent dirs. This does not take into account that stat can fail if the path is a dangling symlink.
The classic mkdir -p
just tries to create a directory and see why it fails. This spares a syscall and handles dangling symlinks transparently.
On Windows this method hit two problems:
- When we have to recurse all the way op to the disk letter,
create_dir_all
fails.
You can't mkdirc:\
or\\host\share
. But we can just stop recursing in time. - Windows can't create a directory through a dangling symlink.
We would have to read the symlink (and possibly resolve it if relative), and create the directory
at the target location ourself.
Would it make sense to go trough this trouble?
I think it is best to only fix this for create_dir_all
and to document the normal create_dir
can not
create a directory trough a dangling symlink on Windows.