refactor: Improve herolib installation script
- Add script directory logging - Update organization name detection - Add symlink verification - Adjust herolib installation path logic
This commit is contained in:
@@ -44,8 +44,10 @@ fn addtoscript(tofind string, toadd string) ! {
|
||||
|
||||
abs_dir_of_script := dir(@FILE)
|
||||
|
||||
println('Script directory: ${abs_dir_of_script}')
|
||||
|
||||
// Determine the organization name from the current path
|
||||
// This makes the script work with any organization (incubaid, incubaid, etc.)
|
||||
// This makes the script work with any organization (incubaid, freeflowuniverse, etc.)
|
||||
path_parts := abs_dir_of_script.split('/')
|
||||
mut org_name := 'incubaid' // default fallback
|
||||
for i, part in path_parts {
|
||||
@@ -56,10 +58,11 @@ for i, part in path_parts {
|
||||
}
|
||||
|
||||
println('Detected organization: ${org_name}')
|
||||
println('Will create symlink: ${os.home_dir()}/.vmodules/${org_name}/herolib -> ${abs_dir_of_script}/lib')
|
||||
|
||||
// Reset symlinks for both possible organizations (cleanup)
|
||||
println('Resetting all symlinks...')
|
||||
os.rm('${os.home_dir()}/.vmodules/incubaid/herolib') or {}
|
||||
os.rm('${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {}
|
||||
os.rm('${os.home_dir()}/.vmodules/incubaid/herolib') or {}
|
||||
os.rm('${os.home_dir()}/.vmodules/${org_name}/herolib') or {}
|
||||
|
||||
@@ -73,6 +76,18 @@ os.symlink('${abs_dir_of_script}/lib', '${os.home_dir()}/.vmodules/${org_name}/h
|
||||
panic('Failed to create herolib symlink: ${err}')
|
||||
}
|
||||
|
||||
// Verify the symlink was created
|
||||
symlink_path := '${os.home_dir()}/.vmodules/${org_name}/herolib'
|
||||
if os.exists(symlink_path) {
|
||||
println('✓ Symlink created successfully: ${symlink_path}')
|
||||
// Verify it points to the right location
|
||||
if os.is_link(symlink_path) {
|
||||
println('✓ Confirmed: ${symlink_path} is a symbolic link')
|
||||
}
|
||||
} else {
|
||||
panic('Failed to verify herolib symlink at ${symlink_path}')
|
||||
}
|
||||
|
||||
println('Herolib installation completed successfully!')
|
||||
|
||||
// Add vtest alias
|
||||
|
||||
Reference in New Issue
Block a user