store davmail.log in user home folder to avoid crash on first start when current directory is not writable by user

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1949 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-04-26 21:09:19 +00:00
parent 7132225895
commit 6a0b615507
1 changed files with 5 additions and 1 deletions

View File

@ -189,10 +189,14 @@ public final class Settings {
*/
public static String getLogFilePath() {
String logFilePath = Settings.getProperty("davmail.logFilePath");
// use default log file path on Mac OS X
// set default log file path
if ((logFilePath == null || logFilePath.length() == 0)) {
if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
// store davmail.log in OSX Logs directory
logFilePath = System.getProperty("user.home") + "/Library/Logs/DavMail/davmail.log";
} else {
// store davmail.log in user home folder
logFilePath = System.getProperty("user.home") + "/davmail.log";
}
} else {
File logFile = new File(logFilePath);