Fix to create the top directory `foo` when specified as `X:foo\bar\filename`, on Windows and MS-DOS. Add test to verify. Caught by Codex Security Follow-up to 787ee935ac #16566 Closes #21449
787ee935ac