fix folder error if path is not start with v (#19328)

This commit is contained in:
minggo 2019-01-21 11:47:15 +08:00 committed by GitHub
parent 8d9bd925c9
commit e991fd392c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -95,6 +95,9 @@ class CocosZipInstaller(object):
self._url = data["repo_parent"] + self._repo_name + '/archive/' + self._filename
self._zip_file_size = int(data["zip_file_size"])
# 'v' letter was swallowed by github, so we need to substring it from the 2nd letter
if self._current_version[0] == 'v':
self._extracted_folder_name = os.path.join(self._workpath, self._repo_name + '-' + self._current_version[1:])
else:
self._extracted_folder_name = os.path.join(self._workpath, self._repo_name + '-' + self._current_version)
try:

View File

@ -234,7 +234,10 @@ class GitArchiver(object):
extra_to_zip_file = zip_file["extract_to_zip_path"]
zip_file_path = os.path.join(zip_file["zip_file_path"], zip_file_name)
# 'v' letter was swallowed by github, so we need to substring it from the 2nd letter
if zip_config["version"][0] == 'v':
extra_folder_name = zip_config["repo_name"] + '-' + zip_config["version"][1:]
else:
extra_folder_name = zip_config["repo_name"] + '-' + zip_config["version"]
extra_folder_path = os.path.join(self.main_repo_abspath, extra_folder_name)
extra_folders.append(extra_folder_path)
extra_file_paths = self.unpack_zipfile(zip_file_path, self.main_repo_abspath)