diff options
author | Martin Szulecki | 2014-10-02 16:15:48 +0200 |
---|---|---|
committer | Martin Szulecki | 2014-10-02 16:15:48 +0200 |
commit | 4a9f1c098cdc0e96ceac5bc3bbf6566cad32d7bd (patch) | |
tree | b0a124bbb2af20bb51f7c05bf25e3094572adf1b /src | |
parent | 3b1e983a519d0b4d820109e953d62bebd181c47c (diff) | |
download | libimobiledevice-4a9f1c098cdc0e96ceac5bc3bbf6566cad32d7bd.tar.gz libimobiledevice-4a9f1c098cdc0e96ceac5bc3bbf6566cad32d7bd.tar.bz2 |
afc: Implement afc_remove_path_and_contents() for recursive deletion
Only available on iOS 6 and later.
Diffstat (limited to 'src')
-rw-r--r-- | src/afc.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -998,6 +998,30 @@ afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mt return ret; } +afc_error_t afc_remove_path_and_contents(afc_client_t client, const char *path) +{ + uint32_t bytes = 0; + afc_error_t ret = AFC_E_UNKNOWN_ERROR; + + if (!client || !path || !client->afc_packet || !client->parent) + return AFC_E_INVALID_ARG; + + afc_lock(client); + + /* Send command */ + ret = afc_dispatch_packet(client, AFC_OP_REMOVE_PATH_AND_CONTENTS, path, strlen(path)+1, NULL, 0, &bytes); + if (ret != AFC_E_SUCCESS) { + afc_unlock(client); + return AFC_E_NOT_ENOUGH_DATA; + } + /* Receive response */ + ret = afc_receive_data(client, NULL, &bytes); + + afc_unlock(client); + + return ret; +} + afc_error_t afc_dictionary_free(char **dictionary) { int i = 0; |