Fix symlink
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adam Štrauch 2023-04-24 22:35:58 +02:00
parent 6fd3278ee8
commit af1e69e594
Signed by: cx
GPG Key ID: 018304FFA8988F8D
2 changed files with 3 additions and 1 deletions

View File

@ -140,6 +140,8 @@ func CPUMemoryStats(applist *[]apps.App, sample int) (*[]apps.App, error) {
} }
func getTechAndVersion(symlink string) (*TechInfo, error) { func getTechAndVersion(symlink string) (*TechInfo, error) {
symlink = strings.TrimSuffix(symlink, "/bin")
link, err := os.Readlink(symlink) link, err := os.Readlink(symlink)
if err != nil { if err != nil {
return nil, fmt.Errorf("error reading symlink: %w", err) return nil, fmt.Errorf("error reading symlink: %w", err)

View File

@ -11,7 +11,7 @@ func TestGetTechAndVersion(t *testing.T) {
tempDir := t.TempDir() tempDir := t.TempDir()
// Create a fake language directory with version in the temporary directory // Create a fake language directory with version in the temporary directory
fakeLangDir := filepath.Join(tempDir, "techs", "python-3.10.4") fakeLangDir := filepath.Join(tempDir, "techs", "python-3.10.4", "bin")
err := os.MkdirAll(fakeLangDir, 0755) err := os.MkdirAll(fakeLangDir, 0755)
if err != nil { if err != nil {
t.Fatalf("Failed to create fake language directory: %v", err) t.Fatalf("Failed to create fake language directory: %v", err)