Example #1
0
def getIconFilenames(dir):
    # We want the processed Info.plist in the .app, not the one in the project.
    # Xcode consolidates asset catalog info into that plist, so it's a reliable
    # source for the names of icon files, regardless of how they got to be that way.
    packagedInfoPlist, _ = lib.loadPlist(os.path.join(dir, "Info.plist"))
    iPhoneIcons = packagedInfoPlist.valueForKeyPath_("CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles") or []
    iPadIcons = packagedInfoPlist.valueForKeyPath_("CFBundleIcons~ipad.CFBundlePrimaryIcon.CFBundleIconFiles") or []

    allIconNames = set(itertools.chain(iPhoneIcons, iPadIcons))

    resSuffixes = ["", "@2x", "@3x"]
    devSuffixes = ["", "~ipad"]

    fns = [
        os.path.join(dir, fn + res + dev + ".png") for fn in allIconNames for res in resSuffixes for dev in devSuffixes
    ]

    return filter(os.path.exists, fns)
Example #2
0
def getIconFilenames(dir):
    # We want the processed Info.plist in the .app, not the one in the project.
    # Xcode consolidates asset catalog info into that plist, so it's a reliable
    # source for the names of icon files, regardless of how they got to be that way.
    packagedInfoPlist, _ = lib.loadPlist(os.path.join(dir, "Info.plist"))
    iPhoneIcons = packagedInfoPlist.valueForKeyPath_("CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles") or []
    iPadIcons = packagedInfoPlist.valueForKeyPath_("CFBundleIcons~ipad.CFBundlePrimaryIcon.CFBundleIconFiles") or []

    fns = []
    fns.extend([fn + ".png" for fn in iPhoneIcons])
    fns.extend([fn + "@2x.png" for fn in iPhoneIcons])
    fns.extend([fn + "@3x.png" for fn in iPhoneIcons])  # IT'S HAPPENING
    fns.extend([fn + "~ipad.png" for fn in iPadIcons])
    fns.extend([fn + "@2x~ipad.png" for fn in iPadIcons])
    fns.extend([fn + "@3x~ipad.png" for fn in iPadIcons])
    fns = [os.path.join(dir, fn) for fn in fns]

    fns = filter(os.path.exists, fns)

    return fns
Example #3
0
def getIconFilenames(dir):
    # We want the processed Info.plist in the .app, not the one in the project.
    # Xcode consolidates asset catalog info into that plist, so it's a reliable
    # source for the names of icon files, regardless of how they got to be that way.
    packagedInfoPlist, _ = lib.loadPlist(os.path.join(dir, 'Info.plist'))
    iPhoneIcons = packagedInfoPlist.valueForKeyPath_(
        'CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles') or []
    iPadIcons = packagedInfoPlist.valueForKeyPath_(
        'CFBundleIcons~ipad.CFBundlePrimaryIcon.CFBundleIconFiles') or []

    allIconNames = set(itertools.chain(iPhoneIcons, iPadIcons))

    resSuffixes = ['', '@2x', '@3x']
    devSuffixes = ['', '~ipad']

    fns = [
        os.path.join(dir, fn + res + dev + '.png') for fn in allIconNames
        for res in resSuffixes for dev in devSuffixes
    ]

    return filter(os.path.exists, fns)