1
0
Fork 0
mirror of https://github.com/actions/setup-java synced 2024-11-14 01:22:39 +00:00
setup-java/src/util.ts

27 lines
663 B
TypeScript
Raw Normal View History

2020-05-02 11:33:15 +00:00
import * as path from 'path';
export function getTempDir() {
let tempDirectory = process.env.RUNNER_TEMP;
if (tempDirectory === undefined) {
let baseLocation;
if (isWindows()) {
// On windows use the USERPROFILE env variable
baseLocation = process.env['USERPROFILE']
? process.env['USERPROFILE']
: 'C:\\';
} else {
if (process.platform === 'darwin') {
baseLocation = '/Users';
} else {
baseLocation = '/home';
}
}
tempDirectory = path.join(baseLocation, 'actions', 'temp');
}
return tempDirectory;
}
export function isWindows() {
return process.platform === 'win32';
}