From 2c01d264abe04570211ba8d3c6d3aa17eced3c80 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 3 Jul 2024 00:49:42 +0200 Subject: [PATCH] fix: home dir on Windows --- src/cache.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cache.ts b/src/cache.ts index dc6aa06..57b817e 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -20,7 +20,9 @@ function checksumFile(hashName: string, path: string): Promise { const pathExists = async (path: string): Promise => !!(await fs.promises.stat(path).catch(() => false)) const getLintCacheDir = (): string => { - return path.resolve(`${process.env.HOME}/.cache/golangci-lint`) + const home = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME + + return path.resolve(`${home}`, `.cache`, `golangci-lint`) } const getIntervalKey = (invalidationIntervalDays: number): string => {