added RootFolder property to the project

This commit is contained in:
Basile Burg 2014-08-17 07:26:52 +02:00
parent a128200b18
commit 1d498524de
3 changed files with 22 additions and 1 deletions

View File

@ -3,7 +3,7 @@ module runnable;
import std.stdio; import std.stdio;
import std.getopt; 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[]) void main(string args[])
{ {

View File

@ -1916,6 +1916,16 @@ begin
result += extractFilePath(fProject.fileName); result += extractFilePath(fProject.fileName);
result += '`'; result += '`';
end; 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': 'CFF', 'CurrentFileFile':
begin begin
result += '`'; result += '`';

View File

@ -21,6 +21,7 @@ type
private private
fOnChange: TNotifyEvent; fOnChange: TNotifyEvent;
fModified: boolean; fModified: boolean;
fRootFolder: string;
fFilename: string; fFilename: string;
fBasePath: string; fBasePath: string;
fLibAliases: TStringList; fLibAliases: TStringList;
@ -34,6 +35,7 @@ type
procedure subMemberChanged(sender : TObject); procedure subMemberChanged(sender : TObject);
procedure setOptsColl(const aValue: TCollection); procedure setOptsColl(const aValue: TCollection);
procedure setFname(const aValue: string); procedure setFname(const aValue: string);
procedure setRoot(const aValue: string);
procedure setSrcs(const aValue: TStringList); procedure setSrcs(const aValue: TStringList);
procedure setConfIx(aValue: Integer); procedure setConfIx(aValue: Integer);
function getConfig(const ix: integer): TCompilerConfiguration; function getConfig(const ix: integer): TCompilerConfiguration;
@ -43,6 +45,7 @@ type
procedure readerError(Reader: TReader; const Message: string; procedure readerError(Reader: TReader; const Message: string;
var Handled: Boolean); var Handled: Boolean);
published published
property RootFolder: string read fRootFolder write setRoot;
property OptionsCollection: TCollection read fOptsColl write setOptsColl; 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 Sources: TStringList read fSrcs write setSrcs; // 'read' should return a copy to avoid abs/rel errors
property ConfigurationIndex: Integer read fConfIx write setConfIx; property ConfigurationIndex: Integer read fConfIx write setConfIx;
@ -126,6 +129,14 @@ begin
fSrcs.Add(ExtractRelativepath(fBasePath,aFilename)); fSrcs.Add(ExtractRelativepath(fBasePath,aFilename));
end; end;
procedure TCEProject.setRoot(const aValue: string);
begin
if fRootFolder = aValue then exit;
beforeChanged;
fRootFolder := aValue;
afterChanged;
end;
procedure TCEProject.setFname(const aValue: string); procedure TCEProject.setFname(const aValue: string);
var var
oldAbs, newRel, oldBase: string; oldAbs, newRel, oldBase: string;