From bcf2e289fb06a9f8a2bab55e16c3ef91cc93c41e Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Thu, 3 Oct 2019 09:06:12 +0200 Subject: [PATCH] windows home directory --- index.js | 9 ++------- index.test.js | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index a41a4515..2f9a2183 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ const core = require('@actions/core'); const path = require('path'); const fs = require('fs'); +const os = require('os'); const settings = require('./settings'); @@ -8,13 +9,7 @@ const settings = require('./settings'); async function run() { try { - var settingsPath; - try { - settingsPath= path.join(process.env['HOME'], '.m2', 'settings.xml'); - } catch (error) { - console.log("HOME=" + process.env['HOME']); - throw error; - } + const settingsPath = path.join(os.homedir(), '.m2', 'settings.xml'); core.info('Prepare maven setings: ' + settingsPath); diff --git a/index.test.js b/index.test.js index 7c0cfefd..3415e3d4 100644 --- a/index.test.js +++ b/index.test.js @@ -13,6 +13,7 @@ beforeAll(() => { } process.env['HOME'] = testHomePath; + process.env['USERPROFILE'] = testHomePath; }); afterEach(() => {