rebuild soft link after file copied to external/ (#19036)

This commit is contained in:
Arnold 2018-09-13 10:08:22 +08:00 committed by minggo
parent 7dcee2bcf9
commit 3d880f9bfb
1 changed files with 17 additions and 0 deletions

View File

@ -260,6 +260,22 @@ class CocosZipInstaller(object):
# remove external except 'config.json'
delete_folder_except(external_folder, ['config.json'])
# rebuild link on linux
def fix_fmod_link(self, extract_dir):
import os
import platform
if platform.system() != "Linux":
return
print("==> Fix fmod link ... ")
fmod_path = os.path.join(extract_dir, "linux-specific/fmod/prebuilt/64-bit")
if os.path.exists(fmod_path):
os.unlink(os.path.join(fmod_path, "libfmod.so.6"))
os.unlink(os.path.join(fmod_path, "libfmodL.so.6"))
os.symlink(os.path.join(fmod_path, "libfmod.so"), os.path.join(fmod_path, "libfmod.so.6"))
os.symlink(os.path.join(fmod_path, "libfmodL.so"), os.path.join(fmod_path, "libfmodL.so.6"))
else:
print("==> fmod directory not found `%s`, failed to fix fmod link!"%fmod_path)
def run(self, workpath, folder_for_extracting, remove_downloaded, force_update, download_only):
if not force_update and not self.need_to_update():
print("==> Not need to update!")
@ -285,6 +301,7 @@ class CocosZipInstaller(object):
if os.path.exists(distDir):
shutil.rmtree(distDir)
shutil.move( os.path.join(folder_for_extracting, srcDir), distDir)
self.fix_fmod_link(folder_for_extracting)
print("==> Cleaning...")
if os.path.exists(self._extracted_folder_name):
shutil.rmtree(self._extracted_folder_name)