From 4f0808904da9682153a3744d20bbb3d2c353ceb3 Mon Sep 17 00:00:00 2001 From: xtophe Date: Thu, 26 Mar 2020 21:58:50 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Add=20:=20Gestion=20de=20la=20cr=C3=A9ation?= =?UTF-8?q?=20des=20r=C3=A9pertoires=20par=20d=C3=A9fauts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ModuleSoundModem/SoundModemCli.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/SoundModemCli.java b/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/SoundModemCli.java index 1383ae5..fc62b57 100644 --- a/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/SoundModemCli.java +++ b/ModuleSoundModem/src/main/java/org/josast/ModuleSoundModem/SoundModemCli.java @@ -5,6 +5,7 @@ package org.josast.ModuleSoundModem; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; @@ -24,7 +25,10 @@ public class SoundModemCli { private static String version = "0.1"; private String configurationfile = "defaultConfigFile.ini"; - private String generateRepository = null; + /* + * Utilisation d'un répertoire par défaut + */ + private String generateRepository = "SoundModemOuput"; /** * @@ -122,6 +126,17 @@ public class SoundModemCli { // tant que connecté à SoundModem => reçoit des trames int cpt = 0; + Path path = Paths.get(generateRepository); + //if directory exists? + if (!Files.exists(path)) { + try { + Files.createDirectories(path); + } catch (IOException e) { + //fail to create directory + e.printStackTrace(); + } + } + while (true) { @@ -154,6 +169,8 @@ public class SoundModemCli { final CommandLine line = parser.parse(options, args); SoundModemCli smc = new SoundModemCli(); + + System.out.println(SoundModemCli.class.getSimpleName() + " " + version); // Si mode aide @@ -194,8 +211,7 @@ public class SoundModemCli { smc.setGenerateRepository(line.getOptionValue("Generate", "")); } - - System.out.println(SoundModemCli.class.getSimpleName() + " " + version); + smc.execute(); } -- GitLab From 0af4afdcc2ec468396b5b46d15c148dd08ab4530 Mon Sep 17 00:00:00 2001 From: xtophe Date: Thu, 26 Mar 2020 22:01:58 +0100 Subject: [PATCH 2/2] Add : Executable jar generation --- ModuleSoundModem/pom.xml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ModuleSoundModem/pom.xml b/ModuleSoundModem/pom.xml index 3912835..7bb0b40 100644 --- a/ModuleSoundModem/pom.xml +++ b/ModuleSoundModem/pom.xml @@ -43,6 +43,38 @@ + + + + org.apache.maven.plugins + maven-assembly-plugin + + + + make-assembly + package + + single + + + + + + + + org.josast.ModuleSoundModem.SoundModemCli + + + + + jar-with-dependencies + + + + + + + -- GitLab