Add default user data folder for mac

pull/1/head
Louis Royer 5 years ago
parent b4927e1994
commit bb1df85273

@ -23,7 +23,11 @@ public class ClientP2P {
d += ".";
}
}
} else {
} else if (os.equals("Mac")||os.equals("Mac OS X") {
/* Apple MacOS X User Data Directory
* https://developer.apple.com/library/archive/qa/qa1170/_index.html */
d = System.getProperty("user.home") + "/Library/";
} else {
d = ".";
}
d += "/P2P_JAVA_PROJECT_CLIENT/";

@ -11,7 +11,8 @@ public class ServerP2P {
/* Follow XDG Base Directory Specification
* https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
*/
if (System.getProperty("os.name").equals("Linux")) {
String os = System.getProperty("os.name");
if (os.equals("Linux")) {
d = System.getenv().get("XDG_DATA_HOME");
if (d == null || d.equals("")) {
d = System.getenv().get("HOME");
@ -21,6 +22,10 @@ public class ServerP2P {
d += ".";
}
}
} else if (os.equals("Mac")||os.equals("Mac OS X") {
/* Apple MacOS X User Data Directory
* https://developer.apple.com/library/archive/qa/qa1170/_index.html */
d = System.getProperty("user.home") + "/Library/";
} else {
d = ".";
}

Loading…
Cancel
Save