Skip to content

Commit e7ee1bd

Browse files
committed
fix: Removed _clearDirectory
1 parent c1bf705 commit e7ee1bd

File tree

2 files changed

+38
-35
lines changed

2 files changed

+38
-35
lines changed

dist/main/index.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ const exec_1 = __nccwpck_require__(5236);
996996
const os = __importStar(__nccwpck_require__(857));
997997
const path = __importStar(__nccwpck_require__(6928));
998998
const assert_1 = __nccwpck_require__(2613);
999-
const fs_1 = __nccwpck_require__(9896);
999+
// import { promises as fs } from "fs";
10001000
class Packages {
10011001
constructor(_lazarusVersion, baseUrl, jsonParam) {
10021002
this.platform = os.platform();
@@ -1055,8 +1055,8 @@ class Packages {
10551055
const pkgFile = await this._download(pkg.RepositoryFileName);
10561056
const pkgFolder = await this._extract(pkgFile, path.join(this._getTempDirectory(), pkg.RepositoryFileHash));
10571057
core.info(`Unzipped to: "${pkgFolder}/${pkg.PackageBaseDir}"`);
1058-
await (0, exec_1.exec)(`rm -rf ${pkgFile}`);
1059-
await this._clearDirectory(pkgFolder);
1058+
//await exec(`rm -rf ${pkgFile}`);
1059+
//await this._clearDirectory(pkgFolder);
10601060
await this._installLpkFiles(pkgFolder, pkg);
10611061
}
10621062
catch (error) {
@@ -1086,19 +1086,22 @@ class Packages {
10861086
core.info(`_download: Downloading ${this.baseUrl}/${filename} to ${downloadPath}`);
10871087
return tc.downloadTool(`${this.baseUrl}/${filename}`, downloadPath);
10881088
}
1089-
async _clearDirectory(dirPath) {
1090-
core.info(`_clearDirectory: Clearing ${dirPath}`);
1091-
if (await fs_1.promises
1092-
.access(dirPath)
1093-
.then(() => true)
1094-
.catch(() => false)) {
1095-
const files = await fs_1.promises.readdir(dirPath);
1096-
await Promise.all(files.map((file) => fs_1.promises.unlink(path.join(dirPath, file))));
1097-
}
1098-
else {
1099-
await fs_1.promises.mkdir(dirPath);
1100-
}
1101-
}
1089+
// private async _clearDirectory(dirPath: string): Promise<void> {
1090+
// core.info(`_clearDirectory: Clearing ${dirPath}`);
1091+
// if (
1092+
// await fs
1093+
// .access(dirPath)
1094+
// .then(() => true)
1095+
// .catch(() => false)
1096+
// ) {
1097+
// const files = await fs.readdir(dirPath);
1098+
// await Promise.all(
1099+
// files.map((file) => fs.unlink(path.join(dirPath, file)))
1100+
// );
1101+
// } else {
1102+
// await fs.mkdir(dirPath);
1103+
// }
1104+
// }
11021105
async _getPackageList(repoURL) {
11031106
core.info(`_getPackageList: Fetching package list from ${repoURL}`);
11041107
try {

src/packages.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { exec } from "@actions/exec/lib/exec";
55
import * as os from "os";
66
import * as path from "path";
77
import { ok } from "assert";
8-
import { promises as fs } from "fs";
8+
// import { promises as fs } from "fs";
99

1010
export class Packages {
1111
private platform: string = os.platform();
@@ -106,8 +106,8 @@ export class Packages {
106106
path.join(this._getTempDirectory(), pkg.RepositoryFileHash)
107107
);
108108
core.info(`Unzipped to: "${pkgFolder}/${pkg.PackageBaseDir}"`);
109-
await exec(`rm -rf ${pkgFile}`);
110-
await this._clearDirectory(pkgFolder);
109+
//await exec(`rm -rf ${pkgFile}`);
110+
//await this._clearDirectory(pkgFolder);
111111
await this._installLpkFiles(pkgFolder, pkg);
112112
} catch (error) {
113113
core.setFailed(`Installation failed: ${(error as Error).message}`);
@@ -154,22 +154,22 @@ export class Packages {
154154
return tc.downloadTool(`${this.baseUrl}/${filename}`, downloadPath);
155155
}
156156

157-
private async _clearDirectory(dirPath: string): Promise<void> {
158-
core.info(`_clearDirectory: Clearing ${dirPath}`);
159-
if (
160-
await fs
161-
.access(dirPath)
162-
.then(() => true)
163-
.catch(() => false)
164-
) {
165-
const files = await fs.readdir(dirPath);
166-
await Promise.all(
167-
files.map((file) => fs.unlink(path.join(dirPath, file)))
168-
);
169-
} else {
170-
await fs.mkdir(dirPath);
171-
}
172-
}
157+
// private async _clearDirectory(dirPath: string): Promise<void> {
158+
// core.info(`_clearDirectory: Clearing ${dirPath}`);
159+
// if (
160+
// await fs
161+
// .access(dirPath)
162+
// .then(() => true)
163+
// .catch(() => false)
164+
// ) {
165+
// const files = await fs.readdir(dirPath);
166+
// await Promise.all(
167+
// files.map((file) => fs.unlink(path.join(dirPath, file)))
168+
// );
169+
// } else {
170+
// await fs.mkdir(dirPath);
171+
// }
172+
// }
173173

174174
private async _getPackageList(repoURL: string): Promise<PackageData[]> {
175175
core.info(`_getPackageList: Fetching package list from ${repoURL}`);

0 commit comments

Comments
 (0)