test: io: add directory deletion test
This commit is contained in:
25
io-test/rmdir.c
Normal file
25
io-test/rmdir.c
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include <blue/io/directory.h>
|
||||||
|
|
||||||
|
int main(int argc, const char **argv)
|
||||||
|
{
|
||||||
|
if (argc < 2) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *path = argv[1];
|
||||||
|
|
||||||
|
b_directory *dir;
|
||||||
|
b_result result = b_directory_open(NULL, B_RV_PATH(path), 0, &dir);
|
||||||
|
if (b_result_is_error(result)) {
|
||||||
|
b_throw(result);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = b_directory_delete(dir);
|
||||||
|
if (b_result_is_error(result)) {
|
||||||
|
b_throw(result);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user