893 sync_delete++; |
893 sync_delete++; |
894 } |
894 } |
895 } |
895 } |
896 ucx_map_free(lres_removed); |
896 ucx_map_free(lres_removed); |
897 |
897 |
|
898 // sort dir list, we need to delete dirs with higher depth first |
|
899 rmdirs = ucx_list_sort(rmdirs, (cmp_func)resource_pathlen_cmp, NULL); |
|
900 // delete dirs |
898 UCX_FOREACH(elm, rmdirs) { |
901 UCX_FOREACH(elm, rmdirs) { |
899 LocalResource *local_dir = elm->data; |
902 LocalResource *local_dir = elm->data; |
900 if(!sync_remove_local_directory(dir, local_dir)) { |
903 if(!sync_remove_local_directory(dir, local_dir)) { |
|
904 // dir successfully removed, now remove the related db entry |
901 LocalResource *local = ucx_map_cstr_remove(db->resources, local_dir->path); |
905 LocalResource *local = ucx_map_cstr_remove(db->resources, local_dir->path); |
902 if(local) { |
906 if(local) { |
903 local_resource_free(local); |
907 local_resource_free(local); |
904 } |
908 } |
905 sync_delete++; |
909 sync_delete++; |