Engine:
* Write log files to different files in a new sub directory depending on "game mode"
--- a/QTfrontend/main.cpp Mon Sep 27 04:58:26 2010 +0200
+++ b/QTfrontend/main.cpp Mon Sep 27 15:40:20 2010 +0200
@@ -364,6 +364,7 @@
checkForDir(cfgdir->absolutePath() + "/Saves");
checkForDir(cfgdir->absolutePath() + "/Screenshots");
checkForDir(cfgdir->absolutePath() + "/Teams");
+ checkForDir(cfgdir->absolutePath() + "/Logs");
}
datadir->cd(bindir->absolutePath());
--- a/hedgewars/hwengine.pas Mon Sep 27 04:58:26 2010 +0200
+++ b/hedgewars/hwengine.pas Mon Sep 27 15:40:20 2010 +0200
@@ -231,6 +231,7 @@
recordFileName:= gameArgs[10];
{$ENDIF}
+ cLogfileBase:= 'game';
initEverything(true);
WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
{$IFDEF DEBUGFILE}
@@ -395,6 +396,7 @@
procedure GenLandPreview{$IFDEF HWLIBRARY}(port: LongInt); cdecl; export{$ENDIF};
var Preview: TPreview;
begin
+ cLogfileBase:= 'preview';
initEverything(false);
{$IFDEF HWLIBRARY}
WriteLnToConsole('Preview connecting on port ' + inttostr(port));
--- a/hedgewars/uMisc.pas Mon Sep 27 04:58:26 2010 +0200
+++ b/hedgewars/uMisc.pas Mon Sep 27 15:40:20 2010 +0200
@@ -43,6 +43,7 @@
//userNick is in uChat
recordFileName : shortstring = '';
cReadyDelay : Longword = 5000;
+ cLogfileBase : shortstring = 'debug';
//////////////////////////
isCursorVisible : boolean;
@@ -808,7 +809,7 @@
{$IFDEF DEBUGFILE}
{$I-}
{$IFDEF IPHONEOS}
- Assign(f,'../Documents/debug.txt');
+ Assign(f,'../Documents/hw-' + cLogfileBase + '.log');
Rewrite(f);
{$ELSE}
if (ParamStr(1) <> '') and (ParamStr(2) <> '') then
@@ -816,7 +817,7 @@
begin
for i:= 0 to 7 do
begin
- assign(f, ExtractFileDir(ParamStr(2)) + '/debug' + inttostr(i) + '.txt');
+ assign(f, ExtractFileDir(ParamStr(2)) + '/Logs/' + cLogfileBase + inttostr(i) + '.log');
rewrite(f);
if IOResult = 0 then break;
end;
@@ -826,7 +827,7 @@
begin
for i:= 0 to 7 do
begin
- assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
+ assign(f, ParamStr(1) + '/Logs/' + cLogfileBase + inttostr(i) + '.log');
rewrite(f);
if IOResult = 0 then break;
end;