mirror of
https://github.com/gradle/actions.git
synced 2025-11-26 17:09:10 +08:00
Locate user home in an OS agnostic way
This commit is contained in:
2
dist/main/index.js
vendored
2
dist/main/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/post/index.js
vendored
2
dist/post/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -2,6 +2,7 @@ import * as core from '@actions/core'
|
|||||||
import * as cache from '@actions/cache'
|
import * as cache from '@actions/cache'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
import * as os from 'os'
|
||||||
|
|
||||||
const WRAPPER_CACHE_KEY = 'WRAPPER_CACHE_KEY'
|
const WRAPPER_CACHE_KEY = 'WRAPPER_CACHE_KEY'
|
||||||
const WRAPPER_CACHE_PATH = 'WRAPPER_CACHE_PATH'
|
const WRAPPER_CACHE_PATH = 'WRAPPER_CACHE_PATH'
|
||||||
@@ -20,7 +21,7 @@ export async function restoreCachedWrapperDist(
|
|||||||
|
|
||||||
const wrapperCacheKey = `wrapper-${wrapperSlug}`
|
const wrapperCacheKey = `wrapper-${wrapperSlug}`
|
||||||
const wrapperCachePath = path.join(
|
const wrapperCachePath = path.join(
|
||||||
process.env.HOME!,
|
os.homedir(),
|
||||||
`.gradle/wrapper/dists/gradle-${wrapperSlug}`
|
`.gradle/wrapper/dists/gradle-${wrapperSlug}`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as httpm from 'typed-rest-client/HttpClient'
|
import * as httpm from 'typed-rest-client/HttpClient'
|
||||||
import * as unzip from 'unzipper'
|
import * as unzip from 'unzipper'
|
||||||
@@ -93,7 +94,7 @@ async function provisionGradle(version: string, url: string): Promise<string> {
|
|||||||
return cachedExecutable
|
return cachedExecutable
|
||||||
}
|
}
|
||||||
|
|
||||||
const home = process.env['HOME'] || ''
|
const home = os.homedir()
|
||||||
const tmpdir = path.join(home, 'gradle-provision-tmpdir')
|
const tmpdir = path.join(home, 'gradle-provision-tmpdir')
|
||||||
const downloadsDir = path.join(tmpdir, 'downloads')
|
const downloadsDir = path.join(tmpdir, 'downloads')
|
||||||
const installsDir = path.join(tmpdir, 'installs')
|
const installsDir = path.join(tmpdir, 'installs')
|
||||||
|
|||||||
Reference in New Issue
Block a user