lib/file: improve error message when attempting to create dir on nonexistent drive on windows

This replaces built-in os.MkdirAll with a patched version that stops the recursion
when reaching the volume part of the path. The original version would continue recursion,
and for extended length paths end up with \\? as the top-level directory, and the error
message would then be something like:
mkdir \\?: The filename, directory name, or volume label syntax is incorrect.
This commit is contained in:
albertony
2021-10-01 23:18:39 +02:00
parent b30731c9d0
commit fbc7f2e61b
21 changed files with 261 additions and 27 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ func New(ctx context.Context, fremote fs.Fs, opt *vfscommon.Options, avFn AddVir
// createDir creates a directory path, along with any necessary parents
func createDir(dir string) error {
return os.MkdirAll(dir, 0700)
return file.MkdirAll(dir, 0700)
}
// createRootDir creates a single cache root directory