fix opening wrong directory, additional logging
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
655020a73f
commit
575157c759
5
main.go
5
main.go
@ -65,6 +65,8 @@ func main() {
|
|||||||
// Reads the ROM files on the filesystem and populates a slice of linageOSROMs
|
// Reads the ROM files on the filesystem and populates a slice of linageOSROMs
|
||||||
func updateROMCache(romDirectory string) {
|
func updateROMCache(romDirectory string) {
|
||||||
|
|
||||||
|
log.Printf("updating ROM cache")
|
||||||
|
|
||||||
f, err := os.Open(romDirectory)
|
f, err := os.Open(romDirectory)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to open ROM directory: %v", err)
|
log.Printf("failed to open ROM directory: %v", err)
|
||||||
@ -140,7 +142,7 @@ func updateROMCache(romDirectory string) {
|
|||||||
// returns true if new builds were moved
|
// returns true if new builds were moved
|
||||||
func moveBuildArtifacts(outDirectory, romDirectory string) bool {
|
func moveBuildArtifacts(outDirectory, romDirectory string) bool {
|
||||||
|
|
||||||
f, err := os.Open(romDirectory)
|
f, err := os.Open(outDirectory)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to open ROM directory: %v", err)
|
log.Printf("failed to open ROM directory: %v", err)
|
||||||
return false
|
return false
|
||||||
@ -169,6 +171,7 @@ func moveBuildArtifacts(outDirectory, romDirectory string) bool {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
newROMs = true
|
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()))
|
err := os.Rename(fmt.Sprintf("%s/%s", outDirectory, v.Name()), fmt.Sprintf("%s/%s", romDirectory, v.Name()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to move file '%s' from out to rom directory: %v", v.Name(), err)
|
log.Printf("failed to move file '%s' from out to rom directory: %v", v.Name(), err)
|
||||||
|
Loading…
Reference in New Issue
Block a user