// mkdir makes the directory and parents using native paths
mkdir makes the directory and parents using native paths
// mkdir makes the directory and parents using native paths
func (f *Fs) mkdir(dirPath string) error {
	if dirPath == "" {
		return nil
	}
	if !strings.HasSuffix(dirPath, "/") {
		dirPath += "/"
	}
	opts := rest.Opts{
		Method:     "MKCOL",
		Path:       dirPath,
		NoResponse: true,
	}
	err := f.pacer.Call(func() (bool, error) {
		resp, err := f.srv.Call(&opts)
		return shouldRetry(resp, err)
	})
	if apiErr, ok := err.(*api.Error); ok {
		if apiErr.StatusCode == http.StatusMethodNotAllowed || apiErr.StatusCode == http.StatusNotAcceptable {
			return nil
		}
		if apiErr.StatusCode == http.StatusConflict {
			err = f.mkParentDir(dirPath)
			if err == nil {
				err = f.mkdir(dirPath)
			}
		}
	}
	return err
}
func ( f * Fs ) mkdir ( dirPath string ) error { if dirPath == " " { return nil } if ! strings . HasSuffix ( dirPath , " " ) { dirPath += " " } opts := rest . Opts { Method : " " , Path : dirPath , NoResponse : true , } err := f . pacer . Call ( func ( ) ( bool , error ) { resp , err := f . srv . Call ( & opts ) return shouldRetry ( resp , err ) } ) if apiErr , ok := err . ( * api . Error ) ; ok { if apiErr . StatusCode == http . StatusMethodNotAllowed || apiErr . StatusCode == http . StatusNotAcceptable { return nil } if apiErr . StatusCode == http . StatusConflict { err = f . mkParentDir ( dirPath ) if err == nil { err = f . mkdir ( dirPath ) } } } return err }
mkdir makes the directory and parents using native paths
mkdir makes the directory and parents using native paths
// defer log.Trace(dirPath, "")("") // We assume the root is already ceated // Collections must end with / // already exists // parent does not exists