This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit 1b99298c1df313abdc859bbb3328376d6c7c5153 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 13 16:29:13 2015 +0200 refs #6935 déplacement atomique d'un module à installer, sinon tentative copie, puis message si vraiment pas possible --- .../fr/ifremer/tutti/ui/swing/updater/Updater.java | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tutti-ui-swing-updater/src/main/java/fr/ifremer/tutti/ui/swing/updater/Updater.java b/tutti-ui-swing-updater/src/main/java/fr/ifremer/tutti/ui/swing/updater/Updater.java index c4b487f..3198c52 100644 --- a/tutti-ui-swing-updater/src/main/java/fr/ifremer/tutti/ui/swing/updater/Updater.java +++ b/tutti-ui-swing-updater/src/main/java/fr/ifremer/tutti/ui/swing/updater/Updater.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.nio.charset.Charset; +import java.nio.file.AtomicMoveNotSupportedException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -170,7 +171,11 @@ public class Updater { pathHelper.makeExecutable(runtimeUpdater); - String message = String.format("Runtime updates available.\nYou must execute '%s' manually to apply new runtime.", runtimeUpdater.getFileName()); + String message = String.format("Une mise à jour de l'exécutable est disponible." + + "\nVous devez lancer le script '%s' en double cliquant dessus dans un explorateur de fichier." + + "\nLe script se trouve dans le dossier %s.", + runtimeUpdater.getFileName(), + runtimeUpdater.toFile().getParentFile()); System.out.println(message); JOptionPane.showMessageDialog(null, message); @@ -252,7 +257,31 @@ public class Updater { // Installing new module System.out.println(String.format("%s Install new version %s", moduleNameStr, newVersion)); Path moduleNewPath = pathHelper.getUpdateModulePath(updateModule); - Files.move(moduleNewPath, modulePath, StandardCopyOption.REPLACE_EXISTING); + + try { + try { + + Files.move(moduleNewPath, modulePath, StandardCopyOption.ATOMIC_MOVE); + + } catch (AtomicMoveNotSupportedException e) { + + // copy atomic impossible + System.out.println(String.format("%s Try fallback install (copy then delete, atomic move is not possible to %s)", moduleNameStr, modulePath)); + Files.copy(moduleNewPath, modulePath, StandardCopyOption.REPLACE_EXISTING); + DeleteHelper.deleteDirectoryOnExit(moduleNewPath); + + } + } catch (IOException e) { + + String message = String.format("La mise à jour du module '%s' a échouée.\nVeuillez contacter un administrateur.", updateModule); + System.out.println(message); + JOptionPane.showMessageDialog(null, message); + + e.printStackTrace(); + + + } + } else { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.