WIP
This commit is contained in:
@@ -374,10 +374,15 @@ func cmdExtract(args []string) {
|
||||
fs := flag.NewFlagSet("extract", flag.ExitOnError)
|
||||
isoDir := fs.String("dir", ".", "directory with ISO files")
|
||||
outDir := fs.String("out", "./wavs", "output directory for WAVs")
|
||||
toolPath := fs.String("tool", "./extract_wavs.sh", "path to extraction script")
|
||||
toolFlag := fs.String("tool", "", "path to extraction script (default: auto-detect)")
|
||||
jobs := fs.Int("jobs", 2, "concurrent extractions")
|
||||
_ = fs.Parse(args)
|
||||
|
||||
toolPath := *toolFlag
|
||||
if toolPath == "" {
|
||||
toolPath = findScript("extract_wavs.sh")
|
||||
}
|
||||
|
||||
entries, err := os.ReadDir(*isoDir)
|
||||
if err != nil {
|
||||
fatal("read dir: %v", err)
|
||||
@@ -410,7 +415,7 @@ func cmdExtract(args []string) {
|
||||
defer func() { <-sem }()
|
||||
|
||||
out := *outDir
|
||||
result, err := extractISO(*toolPath, isoPath, out)
|
||||
result, err := extractISO(toolPath, isoPath, out)
|
||||
mu.Lock()
|
||||
results[filepath.Base(isoPath)] = result
|
||||
mu.Unlock()
|
||||
@@ -505,12 +510,7 @@ func cmdPipeline(args []string) {
|
||||
|
||||
isoDir := filepath.Join(*baseDir, "isos")
|
||||
wavDir := filepath.Join(*baseDir, "wavs")
|
||||
toolPath := filepath.Join(filepath.Dir(os.Args[0]), "extract_wavs.sh")
|
||||
|
||||
if _, err := os.Stat(toolPath); os.IsNotExist(err) {
|
||||
cwd, _ := os.Getwd()
|
||||
toolPath = filepath.Join(cwd, "extract_wavs.sh")
|
||||
}
|
||||
toolPath := findScript("extract_wavs.sh")
|
||||
|
||||
// Remaining args after flags are treated as explicit identifiers
|
||||
identifiers := fs.Args()
|
||||
@@ -563,6 +563,21 @@ func cmdPipeline(args []string) {
|
||||
fmt.Printf(" WAVs: %s\n", wavDir)
|
||||
}
|
||||
|
||||
func findScript(name string) string {
|
||||
candidates := []string{
|
||||
filepath.Join(filepath.Dir(os.Args[0]), name),
|
||||
filepath.Join(filepath.Dir(os.Args[0]), "scripts", name),
|
||||
name,
|
||||
filepath.Join("scripts", name),
|
||||
}
|
||||
for _, p := range candidates {
|
||||
if _, err := os.Stat(p); err == nil {
|
||||
return p
|
||||
}
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
// ─── Helpers ───────────────────────────────────────────────────────────
|
||||
|
||||
func fatal(format string, args ...any) {
|
||||
|
||||
Reference in New Issue
Block a user