Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- ###############################################################################
- ##
- ## Create a CSV file showing a 2 dimensional view of all unique PNG drawables
- ## and the various configurations they are provided for.
- ##
- ###############################################################################
- use strict;
- use Data::Dumper;
- my $path = shift @ARGV || '.';
- my $resDir = "$path/res";
- die "$path does not seem to contain an Android project" unless -d $resDir;
- my %drawables;
- my @imageNames = map { chomp; $_ } qx#find "$resDir" -type f -name '*.png' -exec basename {} .png \\; | sort | uniq#;
- my @drawableDirs = map { chomp; $_ } qx#find "$resDir" -maxdepth 1 -name 'drawable*' | cut -d/ -f3 | sort#;
- print 'imageName,', join(',', @drawableDirs), "\n";
- foreach my $imageName (@imageNames) {
- my @dirs = map { chomp; $_ } qx#find "$resDir" -type f -name "$imageName.png" | cut -d/ -f3#;
- my %dirs = map { $_ => 1 } @dirs;
- print join(',', $imageName, map { $dirs{$_} ? 'x' : '' } @drawableDirs), "\n";
- }
Add Comment
Please, Sign In to add comment