Skip to content

Commit

Permalink
Change PLATFORM to constant instead of function
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolai Laevskii committed May 25, 2023
1 parent eb0b7f8 commit 80a318b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {chmodSync} from 'fs';
import path from 'path';
import os from 'os';
import semver from 'semver';
import {IS_WINDOWS, getPlatform} from './utils';
import {IS_WINDOWS, PLATFORM} from './utils';
import {QualityOptions} from './setup-dotnet';

export interface DotnetVersion {
Expand Down Expand Up @@ -223,7 +223,7 @@ export abstract class DotnetInstallDir {
? DotnetInstallDir.convertInstallPathToAbsolute(
process.env['DOTNET_INSTALL_DIR']
)
: DotnetInstallDir.default[getPlatform()];
: DotnetInstallDir.default[PLATFORM];

private static convertInstallPathToAbsolute(installDir: string): string {
if (path.isAbsolute(installDir)) return path.normalize(installDir);
Expand Down
9 changes: 4 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const IS_WINDOWS = process.platform === 'win32';
export const IS_LINUX = process.platform === 'linux';
export const getPlatform = (): 'windows' | 'linux' | 'mac' => {
if (IS_WINDOWS) return 'windows';
if (IS_LINUX) return 'linux';
export const PLATFORM = ((): 'windows' | 'linux' | 'mac' => {
if (process.platform === 'win32') return 'windows';
if (process.platform === 'linux') return 'linux';
return 'mac';
};
})();

0 comments on commit 80a318b

Please sign in to comment.