(meta composeBackupMeta, composeName string)
| 577 | } |
| 578 | |
| 579 | func resolveComposeRecoverTargetDir(meta composeBackupMeta, composeName string) string { |
| 580 | composePath := strings.TrimSpace(meta.ComposePath) |
| 581 | if composePath != "" { |
| 582 | items := strings.Split(composePath, ",") |
| 583 | for _, item := range items { |
| 584 | p := strings.TrimSpace(item) |
| 585 | if p == "" { |
| 586 | continue |
| 587 | } |
| 588 | ext := strings.ToLower(path.Ext(p)) |
| 589 | if ext == ".yml" || ext == ".yaml" { |
| 590 | return path.Dir(p) |
| 591 | } |
| 592 | return p |
| 593 | } |
| 594 | } |
| 595 | return path.Join(global.Dir.DataDir, "docker/compose", composeName) |
| 596 | } |
| 597 | |
| 598 | func safeJoinWithinBase(baseDir, name string) (string, error) { |
| 599 | base := filepath.Clean(baseDir) |
no outgoing calls
no test coverage detected