MCPcopy Create free account
hub / github.com/WendellCraft/ModpackDebuggerKit / SetModFolderPath

Method SetModFolderPath

app.go:398–435  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

396}
397
398func (a *App) SetModFolderPath(path string) error {
399 a.mu.Lock()
400 if a.ActiveScan {
401 a.mu.Unlock()
402 return fmt.Errorf("cannot change mod folder while a debug scan is in progress")
403 }
404 a.mu.Unlock()
405
406 if path == "" {
407 return fmt.Errorf("path cannot be empty")
408 }
409
410 info, err := os.Stat(path)
411 if err != nil {
412 if os.IsNotExist(err) {
413 return fmt.Errorf("path does not exist: %s", path)
414 }
415 return fmt.Errorf("cannot access path: %v", err)
416 }
417 if !info.IsDir() {
418 return fmt.Errorf("path is not a directory: %s", path)
419 }
420
421 a.mu.Lock()
422 a.ProjectData.ModsDir = path
423 a.ProjectData.Dependencies = make(map[string][]string)
424 a.ProjectData.LatestSnapshot = nil
425 a.ProjectData.SavedNewMods = nil
426 a.ProjectData.DismissedHangingLibs = nil
427 a.ProjectData.RequiredMods = nil
428 a.HangingLibraries = nil
429 a.ProjectModified = true
430 a.mu.Unlock()
431
432 wailsRuntime.EventsEmit(a.ctx, "hanging-libs-alert", 0)
433 a.emitLog(fmt.Sprintf("Mod folder set: %s", path), LogSuccess)
434 return nil
435}
436
437func (a *App) GetAvailableMods() []string {
438 a.mu.Lock()

Callers

nothing calls this directly

Calls 1

emitLogMethod · 0.95

Tested by

no test coverage detected