Przeglądaj źródła

修复没有生成配置bug

yhz 6 lat temu
rodzic
commit
392536a41c
1 zmienionych plików z 18 dodań i 0 usunięć
  1. 18 0
      package_utils_record.py

+ 18 - 0
package_utils_record.py

@@ -63,6 +63,10 @@ def pack(game, sdk, config):
         return ret
     # 添加meta-data
     ret = addMetaData(game, sdk, subChannel, config)
+    if ret:
+        return ret
+    # 增加配置文件
+    ret = addConfig(game, sdk, subChannel, config)
     if ret:
         return ret
     # 复制app res资源
@@ -447,6 +451,20 @@ def addMetaData(game, sdk, subChannel, config):
     xml_utils.addMetaData(manifest, config['metaData'])
     return 0
 
+def addConfig(game, sdk, subChannel, config):
+    '''
+    添加config.json
+    '''
+    if 'configData' not in config:
+        return 0
+
+    print('add config.json...')
+    decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
+    configJson = os.path.join(decompliePath, 'assets', 'record_config.json')
+    jsonText = json.dumps(config['configData'], ensure_ascii=False)
+    file_utils.createFile(configJson, jsonText)
+    return 0
+
 def changePlaceholders(game, sdk, subChannel, config):
     '''
     处理掉占位符