コード例 #1
0
        def wrapper():
            fromDir = baseFrom
            toDir = baseTo
            if not os.path.exists(toDir):
                os.makedirs(toDir)

            from_list = os.listdir(fromDir)

            for file in from_list:
                if "DS_Store" in file:
                    continue
                ff = "%s/%s" % (fromDir, file)
                tt = "%s/%s" % (toDir, file)
                if not os.path.exists(
                        tt) or os.path.getmtime(ff) > os.path.getmtime(tt):
                    shutil.copy(ff, tt)
                    print "copy:", ff, " ========> ", tt
                    if len(inspect.getargspec(func)[0]) == 1:
                        func(tt)
            to_list = os.listdir(toDir)

            if cut:
                for _f in to_list:
                    ff = "%s/%s" % (fromDir, _f)
                    tt = "%s/%s" % (toDir, _f)
                    if not os.path.exists(ff):
                        removeFile(tt)

            print "sync %s successfully......" % f
コード例 #2
0
def getUnseCodeFiles():
    l = getIncludeList()

    ret = []
    for f in l:
        f = f.replace("src", root)
        if not os.path.exists(f):
            ret.append(f)
    if len(ret) > 0:
        print "--------------------------------- 以下是引用了却找不以到的文件 --------------------------"
        print json.dumps(ret, indent=2)

    ret = []
    for (r, _, items) in os.walk(root):
        if items:
            for f in items:
                if "DS_Store" in f:
                    continue
                ff = os.path.join(r, f).replace(root, "src")
                if ff == "src/module.js" or "src/include/module" in ff:
                    continue
                if not ff in l:
                    ret.append(ff)
    if len(ret) > 0:
        dd = "../unuse-src"
        if not os.path.exists(dd):
            os.mkdir(dd)
        print "-------------------------  下面是没有引用到游戏内的代码 -----------------------------------------"
        print json.dumps(ret, indent=2)

        for f in ret:
            copyFile(f.replace("src", root), f.replace("src", dd))
            removeFile(f.replace("src", root))
コード例 #3
0
ファイル: respack.py プロジェクト: tanzuoliang/gameNo1
	def remove_unuse(self):
		if getDirsize(self.resPath) < getDirsize(self.newPath):
			return;
		from_list = getFileListByExt(self.resPath)
		to_list = getFileListByExt(self.newPath)
		
		for f in to_list:
			fr = f.replace(self.newPath,self.resPath,1)
			if not os.path.exists(fr):
				removeFile(f)