Problem creating folders from generator

  • 1
  • Problem
  • Updated 2 years ago
Having a problem exporting icons to folders, and don't know if this is a bug or my syntax is wrong. 

I'm trying to write a script that will export all my ios assets to one folder, and all my Android assets to another folder (with subfolders). I'm almost there, but I'm getting an error for the iOS folder for the 1x graphic. See below:

default 300% ios/@3x + 200% ios/@2x + 100% ios/ + 300% android/drawable_xxhdpi/ + 200% android/drawable_xhdpi/ + 150% android/drawable_hdpi/ + 100% android/drawable_mdpi/
The error I'm getting is: "Duplicate default specification: ios/"

I notice if I change the file name for the 1x graphics. For example, I do "100% ios/@1x" then I don't get the error, but the 1x graphics need to just be the base file name and not have "@1x" in the name.

Is this is a known bug? Is there a workaround? Is my syntax incorrect?

Thanks!
Photo of Elliott

Elliott

  • 100 Posts
  • 5 Reply Likes

Posted 2 years ago

  • 1
Photo of Max Johnson

Max Johnson, Champion

  • 450 Posts
  • 208 Reply Likes
maybe try adding a "/" to the "ios/@2x" and others that don't end with a "/"?
Photo of Elliott

Elliott

  • 100 Posts
  • 5 Reply Likes
That adds additional folders with that name
Photo of Max Johnson

Max Johnson, Champion

  • 450 Posts
  • 208 Reply Likes
Ah, I am sorry, I see what you are trying to do now. I ran a test and it is the order in which you put the ios/ groups that makes the difference... try putting the 100% ios/ as the first grouping instead:
default 100% ios/ + 300% ios/@3x + 200% ios/@2x + 300% android/drawable_xxhdpi/ + 200% android/drawable_xhdpi/ + 150% android/drawable_hdpi/ + 100% android/drawable_mdpi/
Photo of Elliott

Elliott

  • 100 Posts
  • 5 Reply Likes
That did it thanks Max!

This is the final code for reference in case anyone else wants to use it. This will output all your densities (except for xxxhd) for Android, and 3 sizes for iOS.

Your PSD should contain a masked smart object of each layer you're exporting scaled below 33.3% (so it can be scaled up to 300% without losing quality):

default ios/, 200% ios/@2x, 300% ios/@3x, 300% android/drawable_xxhdpi/, 200% android/drawable_xhdpi/, 150% android/drawable_hdpi/, 100% android/drawable_mdpi/