skipping n addons option

master
cheetah 1 year ago
parent c5b6c3c12e
commit 2efe33a1da

@ -123,7 +123,7 @@ func main() {
workerModeP := flag.String("mode", "", "mode (ingress, rebuild)") workerModeP := flag.String("mode", "", "mode (ingress, rebuild)")
debugEnabled := flag.Bool("debug", false, "enables debug") debugEnabled := flag.Bool("debug", false, "enables debug")
folderPathP := flag.String("path", "/mnt/SC9000/TemporaryTestingShit2", "a string") folderPathP := flag.String("path", "/mnt/SC9000/TemporaryTestingShit2", "a string")
skipNameP := flag.String("skip", "", "skip until this name") skipNameP := flag.Int("skip", -1, "skip n addons")
workerNameP := flag.String("worker", "def", "worker name") workerNameP := flag.String("worker", "def", "worker name")
rebuildIDP := flag.String("id", "", "id to rebuild") rebuildIDP := flag.String("id", "", "id to rebuild")
@ -285,8 +285,8 @@ func recursive(jobs []string, folderPath string) (WorkerJobPool []string) {
return jobs return jobs
} }
func modeIngress(folderPath string, skipName string) { func modeIngress(folderPath string, skipN int) {
skipNameEnabled := len(skipName) > 0 // skipNameEnabled := skipN > 0
entries, err := os.ReadDir(folderPath) entries, err := os.ReadDir(folderPath)
if err != nil { if err != nil {
panic(err) panic(err)
@ -298,17 +298,13 @@ func modeIngress(folderPath string, skipName string) {
if e.IsDir() { if e.IsDir() {
WorkerJobPool = recursive(WorkerJobPool, fullPath) WorkerJobPool = recursive(WorkerJobPool, fullPath)
} }
if !e.IsDir() && skipNameEnabled {
if e.Name() == skipName {
skipNameEnabled = false
} else {
continue
}
}
if !e.IsDir() { if !e.IsDir() {
WorkerJobPool = append(WorkerJobPool, filepath.Join(folderPath, e.Name())) WorkerJobPool = append(WorkerJobPool, filepath.Join(folderPath, e.Name()))
} }
} }
if skipN > 0 {
WorkerJobPool = WorkerJobPool[skipN:]
}
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
pw := progress.NewWriter() pw := progress.NewWriter()
@ -560,6 +556,9 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) {
dboGMA2Files = append(dboGMA2Files, dboGMA2File) dboGMA2Files = append(dboGMA2Files, dboGMA2File)
trackerProcess.Increment(1) trackerProcess.Increment(1)
} }
if len(files) < 1 {
return fmt.Errorf("GMA empty, len=%d", len(files))
}
lastFile := files[len(files)-1] lastFile := files[len(files)-1]
dboGMA.FooterAddonCRC, err = gmaReader.ReadAddonCRC(lastFile.Offset + lastFile.FileSize) dboGMA.FooterAddonCRC, err = gmaReader.ReadAddonCRC(lastFile.Offset + lastFile.FileSize)

Loading…
Cancel
Save