mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-28 20:13:10 +08:00
fix
This commit is contained in:
@@ -57,7 +57,7 @@ export class DownloadTask {
|
||||
|
||||
try {
|
||||
try {
|
||||
const exists = fileIo.accessSync(params.targetFile);
|
||||
let exists = fileIo.accessSync(params.targetFile);
|
||||
if (exists) {
|
||||
await fileIo.unlink(params.targetFile);
|
||||
} else {
|
||||
@@ -65,7 +65,7 @@ export class DownloadTask {
|
||||
0,
|
||||
params.targetFile.lastIndexOf('/'),
|
||||
);
|
||||
const exists = fileIo.accessSync(targetDir);
|
||||
exists = fileIo.accessSync(targetDir);
|
||||
if (!exists) {
|
||||
await fileIo.mkdir(targetDir);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class PushyFileJSBundleProvider extends JSBundleProvider {
|
||||
|
||||
async getBundle(): Promise<ArrayBuffer> {
|
||||
try {
|
||||
this.filePath = this.updateContext.getBundleUrl();
|
||||
this.filePath = this.updateContext.getBundleUrl();
|
||||
const res = fileIo.accessSync(this.filePath);
|
||||
if (res) {
|
||||
const file = fileIo.openSync(this.filePath, fileIo.OpenMode.READ_ONLY);
|
||||
|
||||
@@ -101,6 +101,7 @@ export class UpdateContext {
|
||||
params.hash = hash;
|
||||
params.listener = listener;
|
||||
params.targetFile = `${this.rootDir}/${hash}.ppk`;
|
||||
params.unzipDirectory = `${this.rootDir}/${hash}`;
|
||||
const downloadTask = new DownloadTask(this.context);
|
||||
await downloadTask.execute(params);
|
||||
} catch (e) {
|
||||
@@ -162,8 +163,8 @@ export class UpdateContext {
|
||||
const downloadTask = new DownloadTask(this.context);
|
||||
return await downloadTask.execute(params);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
console.error('Failed to download APK patch:', e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user