mkdirAll method
Recursively create folders
Implementation
Future<void> mkdirAll(String path, [CancelToken? cancelToken]) async {
path = fixSlashes(path);
var resp = await this.c.wdMkcol(this, path, cancelToken: cancelToken);
var status = resp.statusCode;
if (status == 201 || status == 405) {
return;
} else if (status == 409) {
var paths = path.split('/');
var sub = '/';
for (var e in paths) {
if (e == '') {
continue;
}
sub += e + '/';
resp = await this.c.wdMkcol(this, sub, cancelToken: cancelToken);
status = resp.statusCode;
if (status != 201 && status != 405) {
throw newResponseError(resp);
}
}
return;
}
throw newResponseError(resp);
}