Merge: core: fix rmdir not reporting some errors
Fix `rmdir` to raise an error on failure to remove a folder, instead of on success. Also fix error management in recursive calls where some errors could be lost.
The name of the attribute `Path::last_error` is misleading with `rmdir` as it stores the first error of the last call, and it is set to `null` if there is no error (overwriting the true last error), so it very rarely contains the actual last error. Note that, `Path::last_error` has a different logic than `Stream::last_error` which does keep the last error and does not reset it. In the future, I would suggest to rename `Path::last_error` to `error` to avoid confusion or to use an array that is cleared at the beginning of each method (as it is currently done with `Path::last_error`).
Pull-Request: #2309
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>