feat 新增上传和删除src文件的功能,增强了文件管理操作的日志输出

This commit is contained in:
Kirito
2026-01-29 18:02:52 +08:00
parent 1cec45853e
commit bb573cc0c1
2 changed files with 33 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ BundleConfig = {
'2006': 'betterjack',
'6007': 'BRWhot',
'2008': 'slots',
'2005': 'christmas',
}
unlinkArray = [
@@ -36,6 +37,7 @@ unlinkArray = [
]
def remove_folder(path):
print('remove path: ', path)
if os.path.exists(path):
if os.path.isfile(path) or os.path.islink(path):
os.remove(path)
@@ -44,6 +46,15 @@ def remove_folder(path):
remove_folder(os.path.join(path, filename))
os.rmdir(path)
SrcDir = BuildDir + '\\src\\'
SrcDst = SubgamePath + 'lib/src/'
rmResult = subprocess.run(['cmd', '/c', 'aws s3 rm ' + SrcDst + ' --recursive'], capture_output=True, text=True)
print('remove dir src result: ', rmResult)
cmd = 'call aws s3 cp '+ SrcDir +' '+SrcDst + ' --recursive --region eu-west-3'
result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True)
print('upload dir src result: ', result)
remove_folder(SrcDir)
for filename in os.listdir(BuildDir):
file_path = os.path.join(BuildDir, filename)
if filename in unlinkArray:
@@ -51,6 +62,10 @@ for filename in os.listdir(BuildDir):
for gameid in BundleConfig:
awsPath = SubgamePath + gameid + '/assets/' + BundleConfig[gameid] +'/'
rmResult = subprocess.run(['cmd', '/c', 'aws s3 rm ' + awsPath + ' --recursive'], capture_output=True, text=True)
print('remove game gameid: ', gameid, ' result: ', rmResult)
subgameDir = BuildDir + 'assets\\' + BundleConfig[gameid] +'\\'
cmd = 'call aws s3 cp '+ subgameDir +' '+awsPath + ' --recursive --region eu-west-3'
result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True)
@@ -65,4 +80,4 @@ for gameid in BundleConfig:
awsPath = SubgamePath + gameid + '/'
cmd = 'call aws s3 cp '+ BuildDir +' '+awsPath + ' --recursive --region eu-west-3'
result = subprocess.run(['cmd', '/c', cmd], capture_output=True, text=True)
print(result)
print('upload game gameid: ', gameid, ' result: ', result)