From 799598973fda3caa6d388989d6bf61c42fedc6d6 Mon Sep 17 00:00:00 2001 From: krizleebear <8003499+krizleebear@users.noreply.github.com> Date: Fri, 26 Aug 2022 17:05:17 +0200 Subject: [PATCH] Improved FileSync stability. Sometimes, music files just can't be copied, even with 'cp' on terminal. Just ignore those files and print an error, as this should be rare cases. --- src/de/christianleberfinger/melodies2go/FileSync.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/de/christianleberfinger/melodies2go/FileSync.java b/src/de/christianleberfinger/melodies2go/FileSync.java index ec41251..df4b19a 100644 --- a/src/de/christianleberfinger/melodies2go/FileSync.java +++ b/src/de/christianleberfinger/melodies2go/FileSync.java @@ -2,6 +2,7 @@ import java.io.File; import java.io.IOException; +import java.nio.file.FileSystemException; import java.nio.file.Path; import java.nio.file.Paths; import java.text.Normalizer; @@ -270,7 +271,13 @@ private void copyMissingFiles() throws IOException if (!destFile.exists()) { - copyFile(track, destFile); + try { + copyFile(track, destFile); + } catch (FileSystemException fse) { + // sometimes, music files just can't be copied, even with 'cp' on terminal. + // just ignore those files and print an error, as this should be a rare case. + System.err.println("Filesystem Error copying " + destFile); + } } } }