mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-22 19:41:08 +07:00
Refactor convertInstallPathToAbsolute
This commit is contained in:
parent
abf9166e44
commit
df506c2d9c
15
dist/index.js
vendored
15
dist/index.js
vendored
@ -350,7 +350,6 @@ class DotnetInstallScript {
|
|||||||
setupScriptBash() {
|
setupScriptBash() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
(0, fs_1.chmodSync)(this.escapedScript, '777');
|
(0, fs_1.chmodSync)(this.escapedScript, '777');
|
||||||
this.scriptArguments = [];
|
|
||||||
this.scriptPath = yield io.which(this.escapedScript, true);
|
this.scriptPath = yield io.which(this.escapedScript, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -385,15 +384,11 @@ class DotnetInstallScript {
|
|||||||
exports.DotnetInstallScript = DotnetInstallScript;
|
exports.DotnetInstallScript = DotnetInstallScript;
|
||||||
class DotnetInstallDir {
|
class DotnetInstallDir {
|
||||||
static convertInstallPathToAbsolute(installDir) {
|
static convertInstallPathToAbsolute(installDir) {
|
||||||
let transformedPath;
|
if (path_1.default.isAbsolute(installDir))
|
||||||
if (path_1.default.isAbsolute(installDir)) {
|
return path_1.default.normalize(installDir);
|
||||||
transformedPath = installDir;
|
const transformedPath = installDir.startsWith('~')
|
||||||
}
|
? path_1.default.join(os_1.default.homedir(), installDir.slice(1))
|
||||||
else {
|
: path_1.default.join(process.cwd(), installDir);
|
||||||
transformedPath = installDir.startsWith('~')
|
|
||||||
? path_1.default.join(os_1.default.homedir(), installDir.slice(1))
|
|
||||||
: (transformedPath = path_1.default.join(process.cwd(), installDir));
|
|
||||||
}
|
|
||||||
return path_1.default.normalize(transformedPath);
|
return path_1.default.normalize(transformedPath);
|
||||||
}
|
}
|
||||||
static addToPath() {
|
static addToPath() {
|
||||||
|
@ -154,9 +154,6 @@ export class DotnetInstallScript {
|
|||||||
|
|
||||||
private async setupScriptBash() {
|
private async setupScriptBash() {
|
||||||
chmodSync(this.escapedScript, '777');
|
chmodSync(this.escapedScript, '777');
|
||||||
|
|
||||||
this.scriptArguments = [];
|
|
||||||
|
|
||||||
this.scriptPath = await io.which(this.escapedScript, true);
|
this.scriptPath = await io.which(this.escapedScript, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,14 +211,12 @@ export abstract class DotnetInstallDir {
|
|||||||
: DotnetInstallDir.default[getPlatform()];
|
: DotnetInstallDir.default[getPlatform()];
|
||||||
|
|
||||||
private static convertInstallPathToAbsolute(installDir: string): string {
|
private static convertInstallPathToAbsolute(installDir: string): string {
|
||||||
let transformedPath;
|
if (path.isAbsolute(installDir)) return path.normalize(installDir);
|
||||||
if (path.isAbsolute(installDir)) {
|
|
||||||
transformedPath = installDir;
|
const transformedPath = installDir.startsWith('~')
|
||||||
} else {
|
? path.join(os.homedir(), installDir.slice(1))
|
||||||
transformedPath = installDir.startsWith('~')
|
: path.join(process.cwd(), installDir);
|
||||||
? path.join(os.homedir(), installDir.slice(1))
|
|
||||||
: (transformedPath = path.join(process.cwd(), installDir));
|
|
||||||
}
|
|
||||||
return path.normalize(transformedPath);
|
return path.normalize(transformedPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user