From 0806cca133fde8bfdebdcc42e003bc318da3b676 Mon Sep 17 00:00:00 2001 From: "Guido L." Date: Thu, 20 Nov 2014 12:59:02 +0100 Subject: [PATCH] Prevent the creation of Logfiles in the Game Directory --- OpenRA.Game/Game.cs | 1 - OpenRA.Game/Support/Log.cs | 17 ++++------------- OpenRA.Utility/Program.cs | 1 - 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 269b4259a2..54925f95c4 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -180,7 +180,6 @@ namespace OpenRA Settings = new Settings(Platform.ResolvePath("^", "settings.yaml"), args); - Log.LogPath = Platform.ResolvePath("^", "Logs"); Log.AddChannel("perf", "perf.log"); Log.AddChannel("debug", "debug.log"); Log.AddChannel("sync", "syncreport.log"); diff --git a/OpenRA.Game/Support/Log.cs b/OpenRA.Game/Support/Log.cs index 498c136aee..f68aa4aa4f 100755 --- a/OpenRA.Game/Support/Log.cs +++ b/OpenRA.Game/Support/Log.cs @@ -22,24 +22,15 @@ namespace OpenRA public static class Log { - static string LogPathPrefix = "."; public static readonly Dictionary Channels = new Dictionary(); - public static string LogPath - { - get { return LogPathPrefix; } - set - { - LogPathPrefix = value; - Directory.CreateDirectory(LogPathPrefix); - } - } - static IEnumerable FilenamesForChannel(string channelName, string baseFilename) { + var path = Platform.SupportDir + "Logs"; + Directory.CreateDirectory(path); + for(var i = 0;; i++ ) - yield return Path.Combine(LogPathPrefix, - i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename); + yield return Path.Combine(path, i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename); } public static void AddChannel(string channelName, string baseFilename) diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index 7fd80722a4..0a403c2ecc 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -28,7 +28,6 @@ namespace OpenRA.Utility AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly; - Log.LogPath = Platform.ResolvePath("^", "Logs"); Log.AddChannel("perf", null); Log.AddChannel("debug", null);