|
|
@ -1,4 +1,5 @@
|
|
|
|
package tools;
|
|
|
|
package tools;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
|
|
|
|
/** Helper to get application directories.
|
|
|
|
/** Helper to get application directories.
|
|
|
|
* @author Louis Royer
|
|
|
|
* @author Louis Royer
|
|
|
@ -24,13 +25,14 @@ public class Directories {
|
|
|
|
/* Follow XDG Base Directory Specification
|
|
|
|
/* Follow XDG Base Directory Specification
|
|
|
|
* https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
|
|
* https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
String d;
|
|
|
|
String os = System.getProperty("os.name");
|
|
|
|
String os = System.getProperty("os.name");
|
|
|
|
if (os.equals("Linux")) {
|
|
|
|
if (os.equals("Linux")) {
|
|
|
|
d = System.getenv().get("XDG_DATA_HOME");
|
|
|
|
d = System.getenv().get("XDG_DATA_HOME");
|
|
|
|
if (d == null || d.equals("")) {
|
|
|
|
if (d == null || d.equals("")) {
|
|
|
|
d = System.getProperty("user.home") + "/.local/share";
|
|
|
|
d = System.getProperty("user.home") + "/.local/share";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (os.equals("Mac")||os.equals("Mac OS X") {
|
|
|
|
} else if (os.equals("Mac")||os.equals("Mac OS X")) {
|
|
|
|
/* Apple MacOS X User Data Directory
|
|
|
|
/* Apple MacOS X User Data Directory
|
|
|
|
* https://developer.apple.com/library/archive/qa/qa1170/_index.html */
|
|
|
|
* https://developer.apple.com/library/archive/qa/qa1170/_index.html */
|
|
|
|
d = System.getProperty("user.home") + "/Library";
|
|
|
|
d = System.getProperty("user.home") + "/Library";
|
|
|
@ -47,7 +49,7 @@ public class Directories {
|
|
|
|
* @return path to the application home directory
|
|
|
|
* @return path to the application home directory
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String getDataHomeDirectory() {
|
|
|
|
public String getDataHomeDirectory() {
|
|
|
|
return dataHomeDirectory();
|
|
|
|
return dataHomeDirectory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|