Commit 7c95accd authored by Locatelli's avatar Locatelli
Browse files

check where is session.properties

parent ecda6cf3
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadmail</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>NomadMail</name>
<description>Helper application to use Nomad server to send mails from VMs</description>
......
......@@ -17,7 +17,9 @@
*/
package fr.ill.ics.mail;
import java.io.File;
import java.io.FileInputStream;
import java.nio.file.Files;
import java.util.Properties;
import fr.ill.ics.cameo.Application;
......@@ -35,6 +37,7 @@ public class MailSender {
private String mailRecipients;
public static String FILE_SEPARATOR = System.getProperty("file.separator");
public static String HOME_DIRECTORY = System.getenv("HOME");
public static String NOMADENDPOINT_DIRECTORY = System.getProperty("java.io.tmpdir") + FILE_SEPARATOR + "nomad";
public static String NOMADENDPOINT_FILE = "session.properties";
public static String NOMADMAIL = "nomadmail";
......@@ -55,7 +58,16 @@ public class MailSender {
private void connectToServer() {
String sessionPropertiesFile = NOMADENDPOINT_DIRECTORY + FILE_SEPARATOR + NOMADENDPOINT_FILE;
String sessionPropertiesFile;
File file = new File(NOMADENDPOINT_DIRECTORY + FILE_SEPARATOR + NOMADENDPOINT_FILE);
if (file.exists()) {
sessionPropertiesFile = NOMADENDPOINT_DIRECTORY + FILE_SEPARATOR + NOMADENDPOINT_FILE;
}
else {
sessionPropertiesFile = HOME_DIRECTORY + FILE_SEPARATOR + NOMADENDPOINT_FILE;
}
Properties sessionProperties = new Properties();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment