Skip to content

Commit 7aac5ea

Browse files
committed
Use a more appropriate log directory on Linux
1 parent 0e4eb5f commit 7aac5ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

FreeserfNet/MainWindow.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ public static MainWindow Create(string[] args)
7575
if (mainWindow != null)
7676
throw new ExceptionFreeserf(ErrorSystemType.Application, "A main window can not be created twice.");
7777

78+
string logDirectory = string.Empty;
79+
7880
try
7981
{
8082
#if !DEBUG
81-
string logDirectory = FileSystem.Paths.IsWindows() ? Program.ExecutablePath : "/var/log/freeserf.net";
83+
logDirectory = FileSystem.Paths.IsWindows() ? Program.ExecutablePath : Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/freeserf";
8284
string logPath = Path.Combine(logDirectory, UserConfig.DefaultLogFile);
8385
Directory.CreateDirectory(logDirectory);
8486
Log.SetStream(new LogFileStream(logPath));
@@ -114,7 +116,7 @@ public static MainWindow Create(string[] args)
114116
string logFile = string.IsNullOrWhiteSpace(UserConfig.Logging.LogFileName) ? UserConfig.DefaultLogFile : UserConfig.Logging.LogFileName;
115117

116118
if (!Path.IsPathRooted(logFile))
117-
logFile = Path.Combine(Program.ExecutablePath, logFile);
119+
logFile = Path.Combine(logDirectory, logFile);
118120

119121
Log.SetStream(new LogFileStream(logFile));
120122
Log.MaxSize = UserConfig.Logging.MaxLogSize;

0 commit comments

Comments
 (0)