Skip to content

Commit

Permalink
fix openjdk path
Browse files Browse the repository at this point in the history
fix #7
  • Loading branch information
aooohan committed Apr 11, 2024
1 parent 1a4944c commit 9853f82
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hooks/post_install.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
local strings = require("vfox.strings")

function PLUGIN:PostInstall(ctx)
if RUNTIME.osType ~= "darwin" then
return
end
local sdkInfo = ctx.sdkInfo['java']
local path = sdkInfo.path
local majorVersion = sdkInfo.note
local v = strings.split(sdkInfo.version, "+")[1]
local needRemoveDir = {
'/jdk-' .. v .. '.jdk',
'/jdk-' .. majorVersion .. '.jdk',
'/Contents/Home'
}
print("Checking if need to rename jdk files...")
for _, dir in ipairs(needRemoveDir) do
print("Checking path: " .. path .. dir)
if checkDir(path .. dir) then
print("Renaming jdk files: " .. path .. dir .. '/*')
if os.execute('mv ' .. path .. dir .. '/*' .. ' ' .. path) == 1 then
Expand Down

0 comments on commit 9853f82

Please sign in to comment.