20 #include <glib/gstdio.h>
27 if (!g_file_test(path, G_FILE_TEST_EXISTS)) {
28 g_set_error(error, G_FILE_ERROR, G_FILE_ERROR_NOENT,
29 "path doesn't exist: %s", path);
33 if (g_file_test(path, G_FILE_TEST_IS_DIR)) {
34 if (g_rmdir(path) == -1) {
35 g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno),
36 "can't remove directory: %s", path);
40 if (g_unlink(path) == -1) {
41 g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno),
42 "can't remove path: %s", path);
53 if (g_file_test(path, G_FILE_TEST_IS_DIR)) {
57 dir = g_dir_open(path, 0, error);
61 while ((name = g_dir_read_name(dir))) {
62 const gchar *full_path;
64 full_path = g_build_filename(path, name, NULL);