Skip to content

Commit 791af98

Browse files
committed
cleanup
1 parent 3753a93 commit 791af98

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

harmony/pushy/src/main/ets/DownloadTask.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,18 @@ export class DownloadTask {
5555
this.hash = params.hash;
5656

5757
try {
58-
try {
59-
let exists = fileIo.accessSync(params.targetFile);
60-
if (exists) {
61-
await fileIo.unlink(params.targetFile);
62-
} else {
63-
const targetDir = params.targetFile.substring(
64-
0,
65-
params.targetFile.lastIndexOf('/'),
66-
);
67-
exists = fileIo.accessSync(targetDir);
68-
if (!exists) {
69-
await fileIo.mkdir(targetDir);
70-
}
58+
let exists = fileIo.accessSync(params.targetFile);
59+
if (exists) {
60+
await fileIo.unlink(params.targetFile);
61+
} else {
62+
const targetDir = params.targetFile.substring(
63+
0,
64+
params.targetFile.lastIndexOf('/'),
65+
);
66+
exists = fileIo.accessSync(targetDir);
67+
if (!exists) {
68+
await fileIo.mkdir(targetDir);
7169
}
72-
} catch (error) {
73-
throw error;
7470
}
7571

7672
const response = await httpRequest.request(params.url, {
@@ -432,7 +428,6 @@ export class DownloadTask {
432428
default:
433429
throw Error(`Unknown task type: ${params.type}`);
434430
}
435-
436431
} catch (error) {
437432
console.error('Task execution failed:', error.message);
438433
if (params.type !== DownloadTaskParams.TASK_TYPE_CLEANUP) {

0 commit comments

Comments
 (0)