Skip to content

Commit

Permalink
idevicebackup2 support iOS10
Browse files Browse the repository at this point in the history
  • Loading branch information
sohgoh committed Aug 26, 2016
1 parent 00f8e57 commit 88a4702
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tools/idevicebackup2.c
Expand Up @@ -1112,6 +1112,26 @@ static void clean_exit(int sig)
quit_flag++;
}

static void clean_snapshot(char *snapshot_dir) {
char subdir[8];
uint32_t i = 0;
struct stat st;

for (i = 0; i < 256; i++) {
sprintf(subdir, "%02x", i);
char *currentpath = string_build_path(snapshot_dir, subdir, NULL);

if ((stat(currentpath, &st) == 0) && S_ISDIR(st.st_mode)) {
#ifdef WIN32
RemoveDirectory(currentpath);
#else
remove(currentpath);
#endif
}
free(currentpath);
}
}

static void print_usage(int argc, char **argv)
{
char *name = NULL;
Expand Down Expand Up @@ -1951,6 +1971,10 @@ int main(int argc, char *argv[])
}
char *newpath = string_build_path(backup_directory, str, NULL);
free(str);

if (strcmp(newpath, "Snapshot")) {
clean_snapshot(newpath);
}
#ifdef WIN32
int res = 0;
if ((stat(newpath, &st) == 0) && S_ISDIR(st.st_mode))
Expand Down

0 comments on commit 88a4702

Please sign in to comment.