From 05dd7fbe7551937fbb5b37edfa0b0927e8be2455 Mon Sep 17 00:00:00 2001
From: Danny McCormick <damccorm@microsoft.com>
Date: Wed, 10 Jul 2019 15:16:09 -0400
Subject: [PATCH] Extract right directory

---
 lib/installer.js | 4 ++--
 src/installer.ts | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/installer.js b/lib/installer.js
index 173216d..7292922 100644
--- a/lib/installer.js
+++ b/lib/installer.js
@@ -49,8 +49,8 @@ function getJava(versionSpec, arch, jdkFile) {
             core.debug('Retrieving Jdk from local path');
             const compressedFileExtension = getFileEnding(jdkFile);
             let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
-            yield unzipJavaDownload(jdkFile, compressedFileExtension, tempDir);
-            toolPath = yield tc.cacheDir(tempDir, 'Java', versionSpec, arch);
+            const jdkDir = yield unzipJavaDownload(jdkFile, compressedFileExtension, tempDir);
+            toolPath = yield tc.cacheDir(jdkDir, 'Java', versionSpec, arch);
         }
         let extendedJavaHome = 'JAVA_HOME_' + versionSpec + '_' + arch;
         core.exportVariable('JAVA_HOME', toolPath);
diff --git a/src/installer.ts b/src/installer.ts
index 706c80a..ea3d3b1 100644
--- a/src/installer.ts
+++ b/src/installer.ts
@@ -40,8 +40,12 @@ export async function getJava(
       tempDirectory,
       'temp_' + Math.floor(Math.random() * 2000000000)
     );
-    await unzipJavaDownload(jdkFile, compressedFileExtension, tempDir);
-    toolPath = await tc.cacheDir(tempDir, 'Java', versionSpec, arch);
+    const jdkDir = await unzipJavaDownload(
+      jdkFile,
+      compressedFileExtension,
+      tempDir
+    );
+    toolPath = await tc.cacheDir(jdkDir, 'Java', versionSpec, arch);
   }
 
   let extendedJavaHome = 'JAVA_HOME_' + versionSpec + '_' + arch;