IDE: save lpi, lps files: keep encoding and eol type, bug #16224

git-svn-id: trunk@24505 -
This commit is contained in:
mattias 2010-04-08 12:47:14 +00:00
parent 5fa2b18a5f
commit c0a2d3d22d

View File

@ -50,7 +50,9 @@ uses
{$ENDIF} {$ENDIF}
Classes, SysUtils, TypInfo, FPCAdds, LCLProc, LCLIntf, LCLType, Forms, Classes, SysUtils, TypInfo, FPCAdds, LCLProc, LCLIntf, LCLType, Forms,
FileUtil, Controls, Dialogs, InterfaceBase, FileUtil, Controls, Dialogs, InterfaceBase,
Laz_XMLCfg, ExprEval, FileProcs, DefineTemplates, CodeToolManager, CodeCache, // codetools
Laz_XMLCfg, CodeToolsConfig, ExprEval, FileProcs, DefineTemplates,
CodeToolManager, CodeCache,
// IDEIntf // IDEIntf
ProjectIntf, MacroIntf, LazIDEIntf, ProjectIntf, MacroIntf, LazIDEIntf,
// IDE // IDE
@ -2599,7 +2601,7 @@ begin
SaveSessionInfoInLPI:=false; SaveSessionInfoInLPI:=false;
repeat repeat
try try
xmlconfig := TXMLConfig.CreateClean(CfgFilename); xmlconfig := TCodeBufXMLConfig.CreateWithCache(CfgFilename,false);
except except
on E: Exception do begin on E: Exception do begin
DebugLn('Error: ', E.Message); DebugLn('Error: ', E.Message);
@ -2722,7 +2724,7 @@ begin
SessionSaveResult:=mrCancel; SessionSaveResult:=mrCancel;
repeat repeat
try try
xmlconfig := TXMLConfig.CreateClean(CurSessionFilename); xmlconfig := TCodeBufXMLConfig.CreateWithCache(CurSessionFilename,false);
except except
on E: Exception do begin on E: Exception do begin
DebugLn('ERROR: ',E.Message); DebugLn('ERROR: ',E.Message);
@ -3032,9 +3034,9 @@ begin
fProjectInfoFileDate:=FileAgeCached(ProjectInfoFile); fProjectInfoFileDate:=FileAgeCached(ProjectInfoFile);
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject A reading lpi');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject A reading lpi');{$ENDIF}
if fProjectInfoFileBuffer=nil then if fProjectInfoFileBuffer=nil then
xmlconfig := TXMLConfig.CreateClean(ProjectInfoFile) xmlconfig := TCodeBufXMLConfig.CreateWithCache(ProjectInfoFile,false)
else else
xmlconfig := TXMLConfig.CreateWithSource(ProjectInfoFile, xmlconfig := TCodeBufXMLConfig.CreateWithCache(ProjectInfoFile,false,true,
fProjectInfoFileBuffer.Source); fProjectInfoFileBuffer.Source);
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject B done lpi');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject B done lpi');{$ENDIF}
except except
@ -3148,7 +3150,7 @@ begin
if FileExistsUTF8(ProjectSessionFile) then begin if FileExistsUTF8(ProjectSessionFile) then begin
//DebugLn('TProject.ReadProject loading Session ProjectSessionFile=',ProjectSessionFile); //DebugLn('TProject.ReadProject loading Session ProjectSessionFile=',ProjectSessionFile);
try try
xmlconfig := TXMLConfig.Create(ProjectSessionFile); xmlconfig := TCodeBufXMLConfig.CreateWithCache(ProjectSessionFile);
Path:='ProjectSession/'; Path:='ProjectSession/';
SessionStorePathDelim:=CheckPathDelim( SessionStorePathDelim:=CheckPathDelim(
@ -4620,7 +4622,7 @@ begin
begin begin
StateFlags:=StateFlags-[lpsfStateFileLoaded]; StateFlags:=StateFlags-[lpsfStateFileLoaded];
try try
XMLConfig:=TXMLConfig.Create(StateFile); XMLConfig:=TCodeBufXMLConfig.CreateWithCache(StateFile);
try try
LastCompilerFilename:=XMLConfig.GetValue('Compiler/Value',''); LastCompilerFilename:=XMLConfig.GetValue('Compiler/Value','');
LastCompilerFileDate:=XMLConfig.GetValue('Compiler/Date',0); LastCompilerFileDate:=XMLConfig.GetValue('Compiler/Date',0);
@ -4658,7 +4660,7 @@ begin
StateFile:=GetStateFilename; StateFile:=GetStateFilename;
try try
CompilerFileDate:=FileAgeCached(CompilerFilename); CompilerFileDate:=FileAgeCached(CompilerFilename);
XMLConfig:=TXMLConfig.CreateClean(StateFile); XMLConfig:=TCodeBufXMLConfig.CreateWithCache(StateFile,false);
try try
XMLConfig.SetValue('Compiler/Value',CompilerFilename); XMLConfig.SetValue('Compiler/Value',CompilerFilename);
XMLConfig.SetValue('Compiler/Date',CompilerFileDate); XMLConfig.SetValue('Compiler/Date',CompilerFileDate);