From d68c56ea01502e946fe9813165120e543598611a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Wed, 17 Jul 2024 13:52:08 -0400 Subject: [PATCH] revert and add some logging --- dist/index.js | 12 ++++++++---- dist/unity-install.ps1 | 8 +++++--- src/index.js | 12 ++++++++---- src/unity-install.ps1 | 8 +++++--- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/dist/index.js b/dist/index.js index ba1c6e2..d0d96a8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -28088,8 +28088,8 @@ const main = async () => { core.debug(`buildTargets: ${buildTargets}`); if (!buildTargets) { - modules = core.getInput('modules'); - var modules = modules.replace(/,/g, '').split(/\s+/); + modules = core.getInput('modules'); + var modules = modules.replace(/,/g, '').split(/\s+/); } else { const osType = os.type(); var moduleMap = undefined; @@ -28171,7 +28171,11 @@ const main = async () => { var install = __nccwpck_require__.ab + "unity-install.ps1"; var exitCode = 0; - exitCode = await exec.exec(`"${pwsh}" -Command`, `${install} ${args}`); + try { + exitCode = await exec.exec(`"${pwsh}" -Command`, `${install} ${args}`); + } catch (error) { + core.error(error); + } if (exitCode != 0) { throw Error(`Unity Installation Failed! exitCode: ${exitCode}`) @@ -28199,7 +28203,7 @@ const findFile = async (dir, filePath) => { } if (matchedFiles.length == 0) { - for(const subDir of directories) { + for (const subDir of directories) { const nestedMatches = await findFile(subDir, filePath); for (const nestedMatch of nestedMatches) { diff --git a/dist/unity-install.ps1 b/dist/unity-install.ps1 index 3125c92..fbbfdf3 100644 --- a/dist/unity-install.ps1 +++ b/dist/unity-install.ps1 @@ -158,6 +158,8 @@ if ( -not (Test-Path -Path "$hubPath") ) { exit 1 } + Write-Host "Unity Hub installed at $hubPath" + sudo chmod -R 777 $hubPath sudo mkdir -p "/Library/Application Support/Unity" sudo chmod -R 777 "/Library/Application Support/Unity" @@ -311,9 +313,9 @@ foreach ($module in (Get-Content -Raw -Path $modulesPath | ConvertFrom-Json -AsH $envEditorPath = $env:UNITY_EDITOR_PATH # if mac or linux update permissons for editor installation -if ($IsMacOS -or $IsLinux) { - sudo chmod -R 777 $editorRootPath -} +# if ($IsMacOS -or $IsLinux) { +# sudo chmod -R 777 $editorRootPath +# } if ([String]::IsNullOrEmpty($envEditorPath)) { Write-Host "" diff --git a/src/index.js b/src/index.js index d40ef1e..baa4da7 100644 --- a/src/index.js +++ b/src/index.js @@ -27,8 +27,8 @@ const main = async () => { core.debug(`buildTargets: ${buildTargets}`); if (!buildTargets) { - modules = core.getInput('modules'); - var modules = modules.replace(/,/g, '').split(/\s+/); + modules = core.getInput('modules'); + var modules = modules.replace(/,/g, '').split(/\s+/); } else { const osType = os.type(); var moduleMap = undefined; @@ -110,7 +110,11 @@ const main = async () => { var install = path.resolve(__dirname, 'unity-install.ps1'); var exitCode = 0; - exitCode = await exec.exec(`"${pwsh}" -Command`, `${install} ${args}`); + try { + exitCode = await exec.exec(`"${pwsh}" -Command`, `${install} ${args}`); + } catch (error) { + core.error(error); + } if (exitCode != 0) { throw Error(`Unity Installation Failed! exitCode: ${exitCode}`) @@ -138,7 +142,7 @@ const findFile = async (dir, filePath) => { } if (matchedFiles.length == 0) { - for(const subDir of directories) { + for (const subDir of directories) { const nestedMatches = await findFile(subDir, filePath); for (const nestedMatch of nestedMatches) { diff --git a/src/unity-install.ps1 b/src/unity-install.ps1 index 3125c92..fbbfdf3 100644 --- a/src/unity-install.ps1 +++ b/src/unity-install.ps1 @@ -158,6 +158,8 @@ if ( -not (Test-Path -Path "$hubPath") ) { exit 1 } + Write-Host "Unity Hub installed at $hubPath" + sudo chmod -R 777 $hubPath sudo mkdir -p "/Library/Application Support/Unity" sudo chmod -R 777 "/Library/Application Support/Unity" @@ -311,9 +313,9 @@ foreach ($module in (Get-Content -Raw -Path $modulesPath | ConvertFrom-Json -AsH $envEditorPath = $env:UNITY_EDITOR_PATH # if mac or linux update permissons for editor installation -if ($IsMacOS -or $IsLinux) { - sudo chmod -R 777 $editorRootPath -} +# if ($IsMacOS -or $IsLinux) { +# sudo chmod -R 777 $editorRootPath +# } if ([String]::IsNullOrEmpty($envEditorPath)) { Write-Host ""