|
|
|
|
@ -2124,6 +2124,29 @@ int yon_file_is_directory(const char *path)
|
|
|
|
|
return S_ISDIR(path_stat.st_mode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_dir_remove(const char *path){
|
|
|
|
|
DIR *d = opendir(path);
|
|
|
|
|
struct dirent *dir;
|
|
|
|
|
|
|
|
|
|
if (d) {
|
|
|
|
|
while ((dir = readdir(d)) != NULL) {
|
|
|
|
|
if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
char full_path[1024];
|
|
|
|
|
snprintf(full_path, sizeof(full_path), "%s/%s", path, dir->d_name);
|
|
|
|
|
|
|
|
|
|
if (dir->d_type == DT_DIR) {
|
|
|
|
|
yon_dir_remove(full_path);
|
|
|
|
|
} else {
|
|
|
|
|
unlink(full_path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closedir(d);
|
|
|
|
|
rmdir(path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// terminal-using functions
|
|
|
|
|
|
|
|
|
|
int yon_launch_app_with_arguments(char *name, char *args)
|
|
|
|
|
|