Exemple #1
0
#!/usr/bin/python
import os
import sys
from copyassets import get_platform


def copy_icons(root, platform):
    icon_root = '%s/%s' % (root, platform)
    if not os.path.isdir(icon_root):
        icon_root = root
    for number, directory in [(32, 'ldpi'), (48, 'mdpi'), (72, 'hdpi'),
                              (96, 'xhdpi'), (144, 'xxhdpi')]:
        os.system('mkdir -p res/drawable-%s' % directory)
        os.system('cp %s/%s.png res/drawable-%s/ic_launcher.png' %
                  (icon_root, number, directory))


if __name__ == '__main__':
    copy_icons(sys.argv[1], get_platform())
Exemple #2
0
#!/usr/bin/python
import os
import sys
from copyassets import get_platform


def copy_icons(root, platform):
    icon_root = '%s/%s' % (root, platform)
    if not os.path.isdir(icon_root):
        icon_root = root
    for number, directory in [(32, 'ldpi'), (48, 'mdpi'), (72, 'hdpi'), (96, 'xhdpi'), (144, 'xxhdpi')]:
        os.system('mkdir -p res/drawable-%s' % directory)
        os.system('cp %s/%s.png res/drawable-%s/ic_launcher.png' % (icon_root, number, directory))


if __name__ == '__main__':
    copy_icons(sys.argv[1], get_platform())
Exemple #3
0
from copyassets import get_platform
import files_pb2


def linkassets(d, target):
    if not os.path.exists(d):
        return
    for f in os.listdir(d):
        p = os.path.relpath(os.path.join(d, f), target)
        os.symlink(p, os.path.join(target, f))


def update_platform(filelist, platform):
    '修改filelist'
    fl = files_pb2.FileList()
    fl.ParseFromString(open(filelist, 'rb').read())
    fl.platform = platform
    if os.path.islink(filelist):
        os.system('rm %s' % filelist)
    open(filelist, 'wb').write(fl.SerializeToString())


if __name__ == '__main__':
    target = 'assets'
    os.system('rm -r %s' % target)
    os.system('mkdir -p %s' % target)
    linkassets('../../assets', target)
    linkassets('extra_assets', target)

    update_platform(os.path.join(target, 'filelist'), get_platform())