0
votes

I would just take a doubt about relative paths. I'm using Delphi XE with all updates.

I developed an internal program to compile our projects and distribute them more flexibly.

I have a feature where I map files ". Groupproj" from Delphi and import the "project include" to my application in the correct build order.

I'm having some problems with relative paths of file that I can not identify its full path.

One way to obtain the full path is to save the project group in the "c: \". Thus, all relative paths are converted.

Currently use the "ExpandFileName" method but does not work the way I like it. For all paths for the group project are not complete. Hence the method can not correctly identify the paths.

Sample XML Group File default:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <ProjectGuid>{1CA5FD23-CD16-4E71-8B84-CF65BC26C390}</ProjectGuid>
    </PropertyGroup>
    <ItemGroup>
        <Projects 
Include="..\..\..\Framework\JBTypes\Package\DXE\Types.dproj">
            <Dependencies/>
        </Projects>
        <Projects 
Include="..\..\..\Framework\JBLib\Package\DXE\JBLib.dproj">
            <Dependencies/>
        </Projects>

Sample XML Group intended:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <ProjectGuid>{1CA5FD23-CD16-4E71-8B84-CF65BC26C390}</ProjectGuid>
    </PropertyGroup>
    <ItemGroup>
        <Projects 
Include="c:\JBSoftware\Systems\Framework\JBTypes\Package\DXE\Types.dproj">
            <Dependencies/>
        </Projects>
        <Projects 
Include="c:\JBSoftware\Systems\Framework\JBLib\Package\DXE\JBLib.dproj">
            <Dependencies/>
        </Projects>

Is there any effective way for me to identify the full path of these group projects?

1
You can convert paths to absolute using the ConvertToAbsolutePath Taskhttp://msdn.microsoft.com/en-us/library/bb882668.aspx - James Woolfenden
Hi @JamesWoolfenden. Thanks for your tip. In Delphi Project Group, the relative path are defined by where the file is saved project group physically. Thus, the relative paths contained in the project group were not resolved correctly. Therefore it is necessary to set the current directory before resolving the relative path. But, I'll test your tip to confirm. - Delphiman

1 Answers

2
votes

Few time after questioning them, just through the help Embarcadero forum, finding the solution. It was just a detail I had not noticed. Really, I did not notice that it was necessary to set the default directory before fetching the full path based.

Sample code used:

//Default directory were project group was saved
ChDir('C:\JBSystems\Components');

//Converting relative path to full path
LbTestList.Items.Add(ExpandFileName('..\Framework\JBLib\Package\JBLib.dproj'));

Is necessary, change current folder with the folder were project group was saved before resolve relative path.

Work perfect.

Thanks.