Created
February 13, 2015 07:58
-
-
Save milesegan/61893ecac9a03cdcc4aa to your computer and use it in GitHub Desktop.
put image assets into correct folder in asset catalog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def usage | |
puts "usage: update_asset_catalog path_to_asset_catalog" | |
exit(1) | |
end | |
def main | |
if ARGV.length < 1 | |
usage | |
end | |
glob = File.join(ARGV.first, "*.png") | |
Dir.glob(glob) do |f| | |
basename = File.basename(f) | |
rootname = f.gsub(/@(2|3)x/, "") | |
destdir = rootname.gsub(".png", ".imageset") | |
dest = File.join(destdir, basename) | |
if test(?d, destdir) | |
puts "#{f} -> #{dest}" | |
File.rename(f, dest) | |
end | |
end | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment