src/main/java/org/edgegallery/appstore/infrastructure/util/AppUtil.java
public void loadZipIntoPackage(String fileAddress, String token, String fileParent) {
        //get unzip  temp folder under csar folder
        try {
            File tempFolder = new File(fileParent);
            FileUtils.deleteDirectory(tempFolder);
            if (!tempFolder.exists() && !tempFolder.mkdirs()) {
                LOGGER.error("create upload path failed");
                throw new FileOperateException("create download file error", ResponseConst.RET_MAKE_DIR_FAILED);
            }
            unzipApplicationPackage(fileAddress, fileParent);
            File file = new File(fileParent);
            File[] files = file.listFiles();
            if (files != null && files.length > 0) {
                String imgZipPath = getImgZipPath(token, fileParent, files);
                addImageFileInfo(fileParent, imgZipPath);
            }
        }  catch (IOException e) {
            LOGGER.error("failed to add image zip to package {} ", e.getMessage());
            throw new AppException(ADD_IMAGE_FILE_FAILED, ResponseConst.RET_IMAGE_TO_PACKAGE_FAILED);
        }
    }
/**
     * load file and analyse file list.
     *
     * @param fileAddress file storage object url.
     */
load file and analyse file list.
@param fileAddress file storage object url.
load file and analyse file list . @param fileAddress file storage object url .
public void loadZipIntoPackage(String fileAddress, String token, String fileParent) {
        try {
            File tempFolder = new File(fileParent);
            FileUtils.deleteDirectory(tempFolder);
            if (!tempFolder.exists() && !tempFolder.mkdirs()) {
                LOGGER.error("create upload path failed");
                throw new FileOperateException("create download file error", ResponseConst.RET_MAKE_DIR_FAILED);
            }
            unzipApplicationPackage(fileAddress, fileParent);
            File file = new File(fileParent);
            File[] files = file.listFiles();
            if (files != null && files.length > 0) {
                String imgZipPath = getImgZipPath(token, fileParent, files);
                addImageFileInfo(fileParent, imgZipPath);
            }
        }  catch (IOException e) {
            LOGGER.error("failed to add image zip to package {} ", e.getMessage());
            throw new AppException(ADD_IMAGE_FILE_FAILED, ResponseConst.RET_IMAGE_TO_PACKAGE_FAILED);
        }
    }
public void loadZipIntoPackage ( String fileAddress , String token , String fileParent ) { try { File tempFolder = new File ( fileParent ) ; FileUtils . deleteDirectory ( tempFolder ) ; if ( ! tempFolder . exists ( ) && ! tempFolder . mkdirs ( ) ) { LOGGER . error ( "create upload path failed" ) ; throw new FileOperateException ( "create download file error" , ResponseConst . RET_MAKE_DIR_FAILED ) ; } unzipApplicationPackage ( fileAddress , fileParent ) ; File file = new File ( fileParent ) ; File [ ] files = file . listFiles ( ) ; if ( files != null && files . length > 0 ) { String imgZipPath = getImgZipPath ( token , fileParent , files ) ; addImageFileInfo ( fileParent , imgZipPath ) ; } } catch ( IOException e ) { LOGGER . error ( "failed to add image zip to package {} " , e . getMessage ( ) ) ; throw new AppException ( ADD_IMAGE_FILE_FAILED , ResponseConst . RET_IMAGE_TO_PACKAGE_FAILED ) ; } }
load file and analyse file list.
load file and analyse file list .
//get unzip  temp folder under csar folder