Commit 534408fe authored by helene ortiz's avatar helene ortiz
Browse files

allow virtual clients to set their own home directory

parent 3639c498
......@@ -63,7 +63,7 @@ public class ConfigManager {
public final static String VIEW_PATTERN = "View.xml";
public final static String COMMAND_VIEW_PATTERN = "CommandView.xml";
public static final String DOT_NOMAD_DIRECTORY = ".nomad";
public static final String DEFAULT_LOCAL_FILES_DIRECTORY = ".nomad";
public static final String NOMAD_CHAT_FILES = ".nomadChats";
public final static String USER_HOME = System.getProperty("user.home");
......@@ -121,6 +121,7 @@ public class ConfigManager {
private boolean mainClient = true;
private String clientType;
private String localFilesDirectory = DEFAULT_LOCAL_FILES_DIRECTORY;
/**
* @return the unique instance of this class
......@@ -626,4 +627,22 @@ public class ConfigManager {
public String getClientType() {
return clientType;
}
public String getLocalFilesDirectory() {
return localFilesDirectory;
}
public void setLocalFilesDirectory(String localFilesDirectory) {
if (!new File(localFilesDirectory).exists()) {
// Directory does not exist: create it
File file = new File(localFilesDirectory);
file.mkdir();
}
if (!new File(localFilesDirectory + ConfigManager.FILE_SEPARATOR + ConfigManager.NOMAD_CHAT_FILES).exists()) {
// Directory for chat's files does not exist: create it
File file = new File(localFilesDirectory + ConfigManager.FILE_SEPARATOR + ConfigManager.NOMAD_CHAT_FILES);
file.mkdir();
}
this.localFilesDirectory = localFilesDirectory;
}
}
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