Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions cmd/commands/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,7 @@ The url is optional. Ex "cpackget connection https://www.keil.com/pack"`,
var err error

if indexPath == "" { // try to fetch from environment
err = configureInstaller(cmd, args)
if err != nil {
return err
}
if err := installer.ReadIndexFiles(); err != nil {
return err
}
}

indexPath, err = installer.GetIndexPath(indexPath)
if err != nil {
return err
indexPath = installer.ConnectionTryURL
}

err = utils.CheckConnection(indexPath, viper.GetInt("timeout"))
Expand Down
13 changes: 8 additions & 5 deletions cmd/installer/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ type PackType struct {
// IsPublic tells whether the pack exists in the public index or not
IsPublic bool

// isInstalled tells whether the pack is already installed
isInstalled bool

// isDownloaded tells whether the file needed to be downloaded from a server
isDownloaded bool

Expand All @@ -51,6 +48,12 @@ type PackType struct {
// targetVersion is the most recent version of a pack in case exactVersion==true
targetVersion string

// isInstalled tells whether the pack is already installed
isInstalled bool

// list of all the packs that are installed
installedVersions []string

// path points to a file in the local system, whether or not it's local
path string

Expand Down Expand Up @@ -139,7 +142,7 @@ func preparePack(packPath string, toBeRemoved, forceLatest, noLocal, nometa bool
}
}

pack.isInstalled = Installation.PackIsInstalled(pack, noLocal)
pack.isInstalled, pack.installedVersions = Installation.PackIsInstalled(pack, noLocal)

return pack, nil
}
Expand Down Expand Up @@ -650,7 +653,7 @@ func (p *PackType) loadDependencies(nometa bool) error {
} else {
pack.versionModifier = utils.LatestVersion
}
if Installation.PackIsInstalled(pack, false) {
if ok, _ := Installation.PackIsInstalled(pack, false); ok {
p.Requirements.packages = append(p.Requirements.packages, struct {
info []string
installed bool
Expand Down
Loading
Loading