# HG changeset patch # User koda # Date 1353546923 -3600 # Node ID df61e150eb707cd68ed8bdab5e0b19b16ef11a61 # Parent 2286a39140da4c75c0105b55e3533c73e10b04d4 revisit the debugfile section diff -r 2286a39140da -r df61e150eb70 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Wed Nov 21 23:34:54 2012 +0100 +++ b/hedgewars/uUtils.pas Thu Nov 22 02:15:23 2012 +0100 @@ -404,7 +404,7 @@ procedure initModule(isNotPreview: boolean); {$IFDEF DEBUGFILE} var logfileBase: shortstring; -{$IFNDEF MOBILE}var i: LongInt;{$ENDIF} + i: LongInt; {$ENDIF} begin {$IFDEF DEBUGFILE} @@ -423,26 +423,25 @@ {$I-} {$IFDEF MOBILE} {$IFDEF IPHONEOS} Assign(f, UserPathPrefix + '/hw-' + logfileBase + '.log'); {$ENDIF} - {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} - Rewrite(f); + {$IFDEF ANDROID} Assign(f, pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} + i:= i; // avoid hint {$ELSE} + f:= stdout; // if everything fails, write to stderr if (UserPathPrefix <> '') then begin - i:= 0; - while(i < 7) do + if not FileExists(UserPathPrefix + '/Logs/') then + CreateDir(UserPathPrefix + '/Logs/'); + i:= 0; + while(i < 7) do begin - assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log'); - rewrite(f); - if IOResult = 0 then - break; - inc(i) + assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log'); + if IOResult = 0 then + break; + inc(i) end; - if i = 7 then - f:= stderr; // if everything fails, write to stderr - end - else - f:= stderr; + end; {$ENDIF} + Rewrite(f); {$I+} {$ENDIF}