diff --git a/lazproj/test/src/expandSymString.d b/lazproj/test/src/expandSymString.d index 54e90c24..fca1b761 100644 --- a/lazproj/test/src/expandSymString.d +++ b/lazproj/test/src/expandSymString.d @@ -3,7 +3,7 @@ module runnable; import std.stdio; import std.getopt; -// pass --a=<CPF> --b=<CPP> --c=<CFF> --d=<CFP> --e=<CI> --f=<CAF> --g=<CAP> as parameters in "Run file..." +// pass --a=<CPF> --b=<CPP> --c=<CPR> --d=<CFF> --e=<CFP> --f=<CI> --g=<CAF> --h=<CAP> as parameters in "Run file..." void main(string args[]) { diff --git a/src/ce_main.pas b/src/ce_main.pas index 57972f94..dbd9cb0d 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -1916,6 +1916,16 @@ begin result += extractFilePath(fProject.fileName); result += '`'; end; + 'CPR', 'CurrentProjectRoot': + begin + result += '`'; + if fProject <> nil then + if directoryExists(fProject.getAbsoluteFilename(fProject.RootFolder)) then + result += fProject.getAbsoluteFilename(fProject.RootFolder) + else if directoryExists(fProject.RootFolder) then + result += fProject.RootFolder; + result += '`'; + end; 'CFF', 'CurrentFileFile': begin result += '`'; diff --git a/src/ce_project.pas b/src/ce_project.pas index 4a33017f..ca7f7842 100644 --- a/src/ce_project.pas +++ b/src/ce_project.pas @@ -21,6 +21,7 @@ type private fOnChange: TNotifyEvent; fModified: boolean; + fRootFolder: string; fFilename: string; fBasePath: string; fLibAliases: TStringList; @@ -34,6 +35,7 @@ type procedure subMemberChanged(sender : TObject); procedure setOptsColl(const aValue: TCollection); procedure setFname(const aValue: string); + procedure setRoot(const aValue: string); procedure setSrcs(const aValue: TStringList); procedure setConfIx(aValue: Integer); function getConfig(const ix: integer): TCompilerConfiguration; @@ -43,6 +45,7 @@ type procedure readerError(Reader: TReader; const Message: string; var Handled: Boolean); published + property RootFolder: string read fRootFolder write setRoot; property OptionsCollection: TCollection read fOptsColl write setOptsColl; property Sources: TStringList read fSrcs write setSrcs; // 'read' should return a copy to avoid abs/rel errors property ConfigurationIndex: Integer read fConfIx write setConfIx; @@ -126,6 +129,14 @@ begin fSrcs.Add(ExtractRelativepath(fBasePath,aFilename)); end; +procedure TCEProject.setRoot(const aValue: string); +begin + if fRootFolder = aValue then exit; + beforeChanged; + fRootFolder := aValue; + afterChanged; +end; + procedure TCEProject.setFname(const aValue: string); var oldAbs, newRel, oldBase: string;