hedgewars/uMisc.pas
changeset 2796 7f86e7ad378b
parent 2753 2305bb5dc5f2
child 2797 98b990feec7d
equal deleted inserted replaced
2795:c9c830897547 2796:7f86e7ad378b
   738 {$ELSE}
   738 {$ELSE}
   739 	for i:= 0 to 7 do
   739 	for i:= 0 to 7 do
   740 	begin
   740 	begin
   741 		assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
   741 		assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
   742 		rewrite(f);
   742 		rewrite(f);
   743 		if IOResult = 5 then
       
   744 		begin
       
   745 			// prevent writing on a directory you do not have permissions on
       
   746 			// should be safe to assume the current directory is writable
       
   747 			assign(f, './debug' + inttostr(i) + '.txt');
       
   748 			rewrite(f);
       
   749 		end;
       
   750 		if IOResult = 0 then break;
   743 		if IOResult = 0 then break;
   751 	end;
   744 	end;
       
   745 	if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr
   752 {$ENDIF}
   746 {$ENDIF}
   753 {$I+}
   747 {$I+}
   754 {$ENDIF}
   748 {$ENDIF}
   755 
   749 
   756 end;
   750 end;