@@ -31,7 +31,6 @@ public class CodePushPackage {
31
31
private final String RELATIVE_BUNDLE_PATH_KEY = "bundlePath" ;
32
32
private final String STATUS_FILE = "codepush.json" ;
33
33
private final String UNZIPPED_FOLDER_NAME = "unzipped" ;
34
- private final String UPDATE_BUNDLE_FILE_NAME = "app.jsbundle" ;
35
34
36
35
private String documentsDirectory ;
37
36
@@ -95,7 +94,7 @@ public String getCurrentPackageFolderPath() {
95
94
return getPackageFolderPath (packageHash );
96
95
}
97
96
98
- public String getCurrentPackageBundlePath () {
97
+ public String getCurrentPackageBundlePath (String bundleFileName ) {
99
98
String packageFolder = getCurrentPackageFolderPath ();
100
99
if (packageFolder == null ) {
101
100
return null ;
@@ -104,7 +103,7 @@ public String getCurrentPackageBundlePath() {
104
103
WritableMap currentPackage = getCurrentPackage ();
105
104
String relativeBundlePath = CodePushUtils .tryGetString (currentPackage , RELATIVE_BUNDLE_PATH_KEY );
106
105
if (relativeBundlePath == null ) {
107
- return CodePushUtils .appendPathComponent (packageFolder , UPDATE_BUNDLE_FILE_NAME );
106
+ return CodePushUtils .appendPathComponent (packageFolder , bundleFileName );
108
107
} else {
109
108
return CodePushUtils .appendPathComponent (packageFolder , relativeBundlePath );
110
109
}
@@ -270,7 +269,7 @@ public void downloadPackage(ReadableMap updatePackage, String expectedBundleFile
270
269
}
271
270
} else {
272
271
// 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 );
274
273
}
275
274
276
275
// Save metadata to the folder.
@@ -307,7 +306,7 @@ public void rollbackPackage() {
307
306
updateCurrentPackageInfo (info );
308
307
}
309
308
310
- public void downloadAndReplaceCurrentBundle (String remoteBundleUrl ) throws IOException {
309
+ public void downloadAndReplaceCurrentBundle (String remoteBundleUrl , String bundleFileName ) throws IOException {
311
310
URL downloadUrl ;
312
311
HttpURLConnection connection = null ;
313
312
BufferedInputStream bin = null ;
@@ -317,7 +316,7 @@ public void downloadAndReplaceCurrentBundle(String remoteBundleUrl) throws IOExc
317
316
downloadUrl = new URL (remoteBundleUrl );
318
317
connection = (HttpURLConnection ) (downloadUrl .openConnection ());
319
318
bin = new BufferedInputStream (connection .getInputStream ());
320
- File downloadFile = new File (getCurrentPackageBundlePath ());
319
+ File downloadFile = new File (getCurrentPackageBundlePath (bundleFileName ));
321
320
downloadFile .delete ();
322
321
fos = new FileOutputStream (downloadFile );
323
322
bout = new BufferedOutputStream (fos , DOWNLOAD_BUFFER_SIZE );
0 commit comments