A small application to manage Lilypond music repositories

Adds replacement strategy for PDF files when updated

+9 -2
+9 -2
compiler/compile.go
··· 48 48 case ".ly": 49 49 msg, err = Lilypond(scores[i].Path) 50 50 case ".pdf": 51 - err = os.Link(scores[i].Path, scores[i].OutputPath) 51 + if helpers.Exists(scores[i].OutputPath) { 52 + os.Remove(scores[i].OutputPath) 53 + } 54 + if err == nil { 55 + err = os.Link(scores[i].Path, scores[i].OutputPath) 56 + } 52 57 } 53 58 54 59 if err != nil { ··· 60 65 } 61 66 } else { 62 67 log.WithFields(log.Fields{ 63 - "score": scores[i], 68 + "score": scores[i], 69 + "outputVersion": helpers.LastModified(scores[i].OutputPath), 64 70 }).Debug("skipping compilation") 65 71 } 66 72 } ··· 84 90 if filepath.Base(path) != "ponder.json" { 85 91 log.WithFields(log.Fields{"path": path}).Info("adding json file") 86 92 score, err = settings.FromJSON(path) 93 + score.LastModified = helpers.LastModified(score.Path) 87 94 } 88 95 89 96 default: