@@ -31,7 +31,6 @@ public class CodePushPackage {
3131 private final String RELATIVE_BUNDLE_PATH_KEY = "bundlePath" ;
3232 private final String STATUS_FILE = "codepush.json" ;
3333 private final String UNZIPPED_FOLDER_NAME = "unzipped" ;
34- private final String UPDATE_BUNDLE_FILE_NAME = "app.jsbundle" ;
3534
3635 private String documentsDirectory ;
3736
@@ -95,7 +94,7 @@ public String getCurrentPackageFolderPath() {
9594 return getPackageFolderPath (packageHash );
9695 }
9796
98- public String getCurrentPackageBundlePath () {
97+ public String getCurrentPackageBundlePath (String bundleFileName ) {
9998 String packageFolder = getCurrentPackageFolderPath ();
10099 if (packageFolder == null ) {
101100 return null ;
@@ -104,7 +103,7 @@ public String getCurrentPackageBundlePath() {
104103 WritableMap currentPackage = getCurrentPackage ();
105104 String relativeBundlePath = CodePushUtils .tryGetString (currentPackage , RELATIVE_BUNDLE_PATH_KEY );
106105 if (relativeBundlePath == null ) {
107- return CodePushUtils .appendPathComponent (packageFolder , UPDATE_BUNDLE_FILE_NAME );
106+ return CodePushUtils .appendPathComponent (packageFolder , bundleFileName );
108107 } else {
109108 return CodePushUtils .appendPathComponent (packageFolder , relativeBundlePath );
110109 }
@@ -270,7 +269,7 @@ public void downloadPackage(ReadableMap updatePackage, String expectedBundleFile
270269 }
271270 } else {
272271 // File is a jsbundle, move it to a folder with the packageHash as its name
273- FileUtils .moveFile (downloadFile , newUpdateFolderPath , UPDATE_BUNDLE_FILE_NAME );
272+ FileUtils .moveFile (downloadFile , newUpdateFolderPath , expectedBundleFileName );
274273 }
275274
276275 // Save metadata to the folder.
@@ -307,7 +306,7 @@ public void rollbackPackage() {
307306 updateCurrentPackageInfo (info );
308307 }
309308
310- public void downloadAndReplaceCurrentBundle (String remoteBundleUrl ) throws IOException {
309+ public void downloadAndReplaceCurrentBundle (String remoteBundleUrl , String bundleFileName ) throws IOException {
311310 URL downloadUrl ;
312311 HttpURLConnection connection = null ;
313312 BufferedInputStream bin = null ;
@@ -317,7 +316,7 @@ public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) throws IOExc
317316 downloadUrl = new URL (remoteBundleUrl );
318317 connection = (HttpURLConnection ) (downloadUrl .openConnection ());
319318 bin = new BufferedInputStream (connection .getInputStream ());
320- File downloadFile = new File (getCurrentPackageBundlePath ());
319+ File downloadFile = new File (getCurrentPackageBundlePath (bundleFileName ));
321320 downloadFile .delete ();
322321 fos = new FileOutputStream (downloadFile );
323322 bout = new BufferedOutputStream (fos , DOWNLOAD_BUFFER_SIZE );
0 commit comments