mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-24 04:21:07 +07:00
Change PLATFORM to constant instead of function
This commit is contained in:
parent
eb0b7f8852
commit
80a318b8b8
@ -7,7 +7,7 @@ import {chmodSync} from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import {IS_WINDOWS, getPlatform} from './utils';
|
import {IS_WINDOWS, PLATFORM} from './utils';
|
||||||
import {QualityOptions} from './setup-dotnet';
|
import {QualityOptions} from './setup-dotnet';
|
||||||
|
|
||||||
export interface DotnetVersion {
|
export interface DotnetVersion {
|
||||||
@ -223,7 +223,7 @@ export abstract class DotnetInstallDir {
|
|||||||
? DotnetInstallDir.convertInstallPathToAbsolute(
|
? DotnetInstallDir.convertInstallPathToAbsolute(
|
||||||
process.env['DOTNET_INSTALL_DIR']
|
process.env['DOTNET_INSTALL_DIR']
|
||||||
)
|
)
|
||||||
: DotnetInstallDir.default[getPlatform()];
|
: DotnetInstallDir.default[PLATFORM];
|
||||||
|
|
||||||
private static convertInstallPathToAbsolute(installDir: string): string {
|
private static convertInstallPathToAbsolute(installDir: string): string {
|
||||||
if (path.isAbsolute(installDir)) return path.normalize(installDir);
|
if (path.isAbsolute(installDir)) return path.normalize(installDir);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
export const IS_WINDOWS = process.platform === 'win32';
|
export const IS_WINDOWS = process.platform === 'win32';
|
||||||
export const IS_LINUX = process.platform === 'linux';
|
export const PLATFORM = ((): 'windows' | 'linux' | 'mac' => {
|
||||||
export const getPlatform = (): 'windows' | 'linux' | 'mac' => {
|
if (process.platform === 'win32') return 'windows';
|
||||||
if (IS_WINDOWS) return 'windows';
|
if (process.platform === 'linux') return 'linux';
|
||||||
if (IS_LINUX) return 'linux';
|
|
||||||
return 'mac';
|
return 'mac';
|
||||||
};
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user