You could improve `toWinPath` function to do correctly copy-on-write operation and remove this const-cast.