MCPcopy Create free account
hub / github.com/celer-pkg/celer / CheckAndRepair

Method CheckAndRepair

configs/toolchain_linux.go:145–173  ·  view source on GitHub ↗
(silent bool)

Source from the content-addressed store, hash-verified

143}
144
145func (t *Toolchain) CheckAndRepair(silent bool) error {
146 // Default folder name is the first folder name of archive name.
147 // but it can be specified by archive name.
148 folderName, _, _ := strings.Cut(t.Path, string(filepath.Separator))
149 if t.Archive != "" {
150 folderName = fileio.Base(t.Archive)
151 }
152
153 // Check and repair resource.
154 archiveName := expr.If(t.Archive != "", t.Archive, filepath.Base(t.Url))
155 toolsDir := filepath.Join(t.ctx.Downloads(), "tools")
156 repair := fileio.NewRepair(t.Url, t.ctx.Downloads(), archiveName, folderName, toolsDir, t.SHA256)
157 if err := repair.CheckAndRepair(t.ctx); err != nil {
158 return err
159 }
160
161 if !silent {
162 // Print download & extract info.
163 if t.rootDir == "" {
164 color.PrintPass("\ntoolchain: %s", "local")
165 color.PrintHint("Location: %s\n", strings.ReplaceAll(t.Url, "file:///", ""))
166 } else {
167 color.PrintPass("toolchain: %s", t.displayName)
168 color.PrintHint("Location: %s\n", t.rootDir)
169 }
170 }
171
172 return nil
173}
174
175// Detect detect local installed gcc.
176func (t *Toolchain) Detect(platformName string) error {

Callers 1

DetectMethod · 0.95

Calls 7

CheckAndRepairMethod · 0.95
BaseFunction · 0.92
IfFunction · 0.92
NewRepairFunction · 0.92
PrintPassFunction · 0.92
PrintHintFunction · 0.92
DownloadsMethod · 0.65

Tested by

no test coverage detected