Don't spam logs and replays all over my home directory kthx.
Logs and replays are written to subdirectories of the "Support" folder. Default location is <game dir>/Support/; Can be overridden on game start.
This commit is contained in:
@@ -563,7 +563,14 @@ namespace OpenRA
|
||||
{
|
||||
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
|
||||
|
||||
LoadUserSettings(settings);
|
||||
LoadUserSettings(settings);
|
||||
|
||||
Log.LogPath = SupportDir + "Logs" + Path.DirectorySeparatorChar;
|
||||
Log.AddChannel("perf", "perf.log", false, false);
|
||||
Log.AddChannel("debug", "debug.log", false, false);
|
||||
Log.AddChannel("sync", "syncreport.log", true, true);
|
||||
|
||||
|
||||
LobbyInfo.GlobalSettings.Mods = Settings.InitialMods;
|
||||
|
||||
// Load the default mod to access required files
|
||||
@@ -596,7 +603,6 @@ namespace OpenRA
|
||||
|
||||
ResetTimer();
|
||||
|
||||
Log.AddChannel("sync", "openra.syncreport.txt", true, true);
|
||||
}
|
||||
|
||||
static void LoadUserSettings(Settings settings)
|
||||
@@ -636,13 +642,26 @@ namespace OpenRA
|
||||
|
||||
Chrome.rootWidget.CloseWindow();
|
||||
Chrome.rootWidget.OpenWindow("MAINMENU_BG");
|
||||
}
|
||||
}
|
||||
|
||||
public static string SupportDir
|
||||
{
|
||||
get {
|
||||
// Unless the user has specified otherwise, put support files in a subdirectory of the game install
|
||||
if (Settings.SupportDir == null)
|
||||
return Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Support" + Path.DirectorySeparatorChar;
|
||||
|
||||
// Custom paths are relative to the home directory (My Documents under windows)
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.Personal) + Path.DirectorySeparatorChar + Settings.SupportDir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal static int GetGameId()
|
||||
{
|
||||
try
|
||||
{
|
||||
string s = File.ReadAllText(Log.LogPathPrefix + "openra.gameid");
|
||||
string s = File.ReadAllText(SupportDir + "currentgameid");
|
||||
return int.Parse(s);
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -653,7 +672,7 @@ namespace OpenRA
|
||||
|
||||
internal static void SetGameId(int id)
|
||||
{
|
||||
var file = File.CreateText(Log.LogPathPrefix + "openra.gameid");
|
||||
var file = File.CreateText(SupportDir + "currentgameid");
|
||||
file.Write(id);
|
||||
file.Flush();
|
||||
file.Close();
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace OpenRA.GameRules
|
||||
{
|
||||
public class UserSettings
|
||||
{
|
||||
public readonly string SupportDir = null;
|
||||
|
||||
// Debug settings
|
||||
public bool UnitDebug = false;
|
||||
public bool PathDebug = true;
|
||||
|
||||
@@ -62,10 +62,9 @@ namespace OpenRA.Network
|
||||
public OrderManager( IConnection conn, string replayFilename )
|
||||
: this( conn )
|
||||
{
|
||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
|
||||
+ Path.DirectorySeparatorChar + ".openra";
|
||||
string path = Game.SupportDir + "Replays" + Path.DirectorySeparatorChar;
|
||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||
replaySaveFile = File.Create( path + Path.DirectorySeparatorChar + replayFilename );
|
||||
replaySaveFile = File.Create( path + replayFilename );
|
||||
}
|
||||
|
||||
public void IssueOrders( Order[] orders )
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace OpenRA
|
||||
{
|
||||
// brutal hack
|
||||
Application.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
Log.AddChannel("perf", "openra.perf.txt", false, false);
|
||||
|
||||
if (Debugger.IsAttached || args.Contains("--just-die"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user