Skip to content

Instantly share code, notes, and snippets.

@lolgear
Created December 13, 2012 10:59
Show Gist options
  • Save lolgear/4275724 to your computer and use it in GitHub Desktop.
Save lolgear/4275724 to your computer and use it in GitHub Desktop.
reset settings and content ios simulator script
#!/usr/bin/perl
sub before_space{
for(@_){
s/[ ]/\\ /g;
}
return @_;
}
my $path = $ENV{HOME}.'/';
$path .= q(Library/Application Support/iPhone Simulator);
unless(@ARGV){
print "use key -h or --help for help information\n"; exit(0);
}
for(@ARGV){
if (/-h/){
print qx(perldoc -t $0); exit(0);
}
if (/-l/){
print qx(ls $path),"\n"; exit(0);
}
}
my %hash = @ARGV;
$hash{'-v'}=$hash{'--version'}||$hash{'-v'}||"";
my $delete_path = $path.'/'.$hash{'-v'};
before_space($delete_path);
print qq(will do command: \n rm -rf $delete_path),"\n";
if(-e $delete_path){
print qq(will empty this: $delete_path\n);
print system(qq(rm -rf $delete_path));
}
else{
print qq(this path does not exists! $delete_path\n);
}
__END__
=head1 DESCRIPTION
reset settings and content of ios simulator
keys:
-h||--help - help
-v||--version - specific version
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment