Make copy ship more better

This commit is contained in:
2024-09-17 12:47:07 +02:00
parent 56a355f930
commit f1c7825d95
3 changed files with 7 additions and 23 deletions

View File

@@ -76,7 +76,8 @@ func main() {
planFileDst := filepath.Join(avorionRoaming, "ships", "plans", file.Name()+".plan.xml")
turretFileDst := filepath.Join(avorionRoaming, "ships", "turrets", file.Name()+".turret.xml")
if FileExists(shipFileSrc) {
if FileExists(shipFileSrc) && !FileExists(shipFileDst) {
log.Printf("Copying '%s' to '%s'", shipFileSrc, shipFileDst)
err := Copy(shipFileSrc, shipFileDst)
if err != nil {
Error.Printf("Error copying '%s' to '%s': '%v'", shipFileSrc, shipFileDst, err)
@@ -84,7 +85,8 @@ func main() {
}
}
if FileExists(planFileSrc) {
if FileExists(planFileSrc) && !FileExists(planFileDst) {
log.Printf("Copying '%s' to '%s'", planFileSrc, planFileDst)
err := Copy(planFileSrc, planFileDst)
if err != nil {
Error.Printf("Error copying '%s' to '%s': '%v'", planFileSrc, planFileDst, err)
@@ -92,7 +94,8 @@ func main() {
}
}
if FileExists(turretFileSrc) {
if FileExists(turretFileSrc) && !FileExists(turretFileDst) {
log.Printf("Copying '%s' to '%s'", turretFileSrc, turretFileDst)
err := Copy(turretFileSrc, turretFileDst)
if err != nil {
Error.Printf("Error copying '%s' to '%s': '%v'", turretFileSrc, turretFileDst, err)