You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
780 B
31 lines
780 B
package manager |
|
|
|
import ( |
|
"fmt" |
|
"os" |
|
"path/filepath" |
|
|
|
"github.com/Unbewohnte/OBM/logger" |
|
) |
|
|
|
// parses each difficulty for background info, removes found backgrounds |
|
func (BEATMAP *Beatmap) RemoveBackgrounds() (successful, failed uint) { |
|
// looping through each .osu file of a beatmap |
|
for _, diff := range BEATMAP.Diffs { |
|
background, err := BEATMAP.GetBackgroundName(diff) |
|
if err != nil || background == "" { |
|
logger.LogError(false, fmt.Sprintf("BEATMAP: %s: Error getting background filename: %s", diff, err)) |
|
failed++ |
|
continue |
|
} |
|
// remove background |
|
err = os.Remove(filepath.Join(BEATMAP.Path, background)) |
|
if err != nil { |
|
// background file does not exist (success ???) |
|
successful++ |
|
continue |
|
} |
|
successful++ |
|
} |
|
return successful, failed |
|
}
|
|
|