Created
          January 6, 2018 12:42 
        
      - 
      
- 
        Save matiaskorhonen/1c5f6b814ffdfb1636f35c952c8e4631 to your computer and use it in GitHub Desktop. 
    Small script to rename iOS app icons
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | require "fileutils" | |
| require "json" | |
| json = File.open("Contents.json", "r+") | |
| contents = JSON.load(json.read) | |
| contents["images"].map do |image| | |
| ext = File.extname(image["filename"]) | |
| new_filename = "#{image["size"]}@#{image["scale"]}#{ext}" | |
| FileUtils.mv(image["filename"], new_filename) | |
| image["filename"].replace(new_filename) | |
| end | |
| json.rewind | |
| json.write(JSON.pretty_generate(contents)) | |
| json.close | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment