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

Method CheckAndRepair

configs/toolchain_windows.go:216–245  ·  view source on GitHub ↗
(silent bool)

Source from the content-addressed store, hash-verified

214}
215
216func (t *Toolchain) CheckAndRepair(silent bool) error {
217 // Default folder name is the first folder name of archive name,
218 // but it can be specified by archive name.
219 folderName := strings.Split(t.Path, string(filepath.Separator))[0]
220 if t.Archive != "" {
221 folderName = fileio.Base(t.Archive)
222 }
223
224 // Use archive name as download file name if specified.
225 archive := expr.If(t.Archive != "", t.Archive, filepath.Base(t.Url))
226
227 // Check and repair resource.
228 toolsDir := filepath.Join(t.ctx.Downloads(), "tools")
229 repair := fileio.NewRepair(t.Url, t.ctx.Downloads(), archive, folderName, toolsDir, t.SHA256)
230 if err := repair.CheckAndRepair(t.ctx); err != nil {
231 return err
232 }
233
234 // Print download & extract info.
235 if !silent {
236 if t.rootDir == "" {
237 color.PrintPass("toolchain: %s", "local")
238 color.PrintHint("Location: %s\n", strings.ReplaceAll(t.Url, "file:///", ""))
239 } else {
240 color.PrintPass("toolchain: %s", t.displayName)
241 color.PrintHint("Location: %s\n", t.rootDir)
242 }
243 }
244 return nil
245}
246
247// Detect detect local installed MSVC.
248func (t *Toolchain) Detect(toolchainName 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