fix #36, project sources saved before relative path extraction

This commit is contained in:
Basile Burg 2016-04-23 18:21:14 +02:00
parent fd0b9ae226
commit c00938fad2
1 changed files with 11 additions and 8 deletions

View File

@ -67,7 +67,8 @@ type
procedure beforeLoad; override; procedure beforeLoad; override;
procedure afterSave; override; procedure afterSave; override;
procedure afterLoad; override; procedure afterLoad; override;
procedure setFilename(const aValue: string); override; procedure customSaveToFile(const aFilename: string); override;
procedure customLoadFromFile(const aFilename: string); override;
procedure readerPropNoFound(Reader: TReader; Instance: TPersistent; procedure readerPropNoFound(Reader: TReader; Instance: TPersistent;
var PropName: string; IsPath: Boolean; var Handled, Skip: Boolean); override; var PropName: string; IsPath: Boolean; var Handled, Skip: Boolean); override;
published published
@ -226,18 +227,20 @@ begin
endUpdate; endUpdate;
end; end;
procedure TCENativeProject.setFilename(const aValue: string); procedure TCENativeProject.customLoadFromFile(const aFilename: string);
begin
fbasePath := aFilename.extractFilePath;
inherited customLoadFromFile(aFilename);
end;
procedure TCENativeProject.customSaveToFile(const aFilename: string);
var var
oldAbs, newRel, oldBase: string; oldAbs, newRel, oldBase: string;
i: NativeInt; i: NativeInt;
begin begin
if fFilename = aValue then exit;
//
beginUpdate; beginUpdate;
fFilename := aValue;
oldBase := fBasePath; oldBase := fBasePath;
fBasePath := fFilename.extractFilePath; fBasePath := aFilename.extractFilePath;
// //
for i:= 0 to fSrcs.Count-1 do for i:= 0 to fSrcs.Count-1 do
begin begin
@ -245,8 +248,8 @@ begin
newRel := ExtractRelativepath(fBasePath, oldAbs); newRel := ExtractRelativepath(fBasePath, oldAbs);
fSrcs[i] := newRel; fSrcs[i] := newRel;
end; end;
//
endUpdate; endUpdate;
inherited customSaveToFile(aFilename);
end; end;
procedure TCENativeProject.setLibAliases(const value: TStringList); procedure TCENativeProject.setLibAliases(const value: TStringList);