Skip to content

Commit

Permalink
fix: return err if symlink is not created (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnWeber authored May 13, 2024
1 parent 9a0034b commit 3614e26
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package internal
import (
"errors"
"fmt"
"github.com/version-fox/vfox/internal/shim"
"io"
"net"
"net/http"
Expand All @@ -31,6 +30,8 @@ import (
"strings"
"syscall"

"github.com/version-fox/vfox/internal/shim"

"github.com/pterm/pterm"
"github.com/schollz/progressbar/v3"
"github.com/version-fox/vfox/internal/env"
Expand Down Expand Up @@ -67,14 +68,14 @@ func (s *SdkEnv) linkToCurrent(targetDir string) (*env.Paths, error) {
}
if util.FileExists(tp) {
if err := os.Remove(tp); err != nil {
logger.Debugf("Failed to remove symlink %s\n", tp)
continue
logger.Errorf("Failed to remove symlink %s\n", tp)
return nil, err
}
}
_ = os.MkdirAll(targetDir, 0755)
if err := util.MkSymlink(p, tp); err != nil {
logger.Debugf("Failed to create symlink %s -> %s\n", p, targetDir)
continue
logger.Errorf("Failed to create symlink %s -> %s\n", p, tp)
return nil, err
}
paths.Add(tp)
}
Expand Down

0 comments on commit 3614e26

Please sign in to comment.