|
|
|
@ -1,13 +1,25 @@
|
|
|
|
|
package tools;
|
|
|
|
|
|
|
|
|
|
/** Helper to get application directories.
|
|
|
|
|
* @author Louis Royer
|
|
|
|
|
* @author Flavien Haas
|
|
|
|
|
* @author JS Auge
|
|
|
|
|
* @version 1.0
|
|
|
|
|
*/
|
|
|
|
|
public class Directories {
|
|
|
|
|
private String projectName;
|
|
|
|
|
private String dataHomeDirectory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Constructor with projectName parameter.
|
|
|
|
|
* @param projectName name of the project
|
|
|
|
|
*/
|
|
|
|
|
public Directories(String projectName) {
|
|
|
|
|
this.projectName = projectName;
|
|
|
|
|
setDataHomeDirectory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Setter for dataHomeDirectory. Will create the directory if not already exists.
|
|
|
|
|
*/
|
|
|
|
|
private void setDataHomeDirectory() {
|
|
|
|
|
/* Follow XDG Base Directory Specification
|
|
|
|
|
* https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
|
|
@ -31,6 +43,9 @@ public class Directories {
|
|
|
|
|
dataHomeDirectory = d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Getter for dataHomeDirectory.
|
|
|
|
|
* @return path to the application home directory
|
|
|
|
|
*/
|
|
|
|
|
public String getDataHomeDirectory() {
|
|
|
|
|
return dataHomeDirectory();
|
|
|
|
|
}
|
|
|
|
|