fix opening wrong directory, additional logging
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Steven Polley 2023-06-04 13:34:09 -06:00
parent 655020a73f
commit 575157c759
1 changed files with 4 additions and 1 deletions

View File

@ -65,6 +65,8 @@ func main() {
// Reads the ROM files on the filesystem and populates a slice of linageOSROMs
func updateROMCache(romDirectory string) {
log.Printf("updating ROM cache")
f, err := os.Open(romDirectory)
if err != nil {
log.Printf("failed to open ROM directory: %v", err)
@ -140,7 +142,7 @@ func updateROMCache(romDirectory string) {
// returns true if new builds were moved
func moveBuildArtifacts(outDirectory, romDirectory string) bool {
f, err := os.Open(romDirectory)
f, err := os.Open(outDirectory)
if err != nil {
log.Printf("failed to open ROM directory: %v", err)
return false
@ -169,6 +171,7 @@ func moveBuildArtifacts(outDirectory, romDirectory string) bool {
continue
}
newROMs = true
log.Printf("new build found - moving file %s", v.Name())
err := os.Rename(fmt.Sprintf("%s/%s", outDirectory, v.Name()), fmt.Sprintf("%s/%s", romDirectory, v.Name()))
if err != nil {
log.Printf("failed to move file '%s' from out to rom directory: %v", v.Name(), err)