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