OK WP, finally found the time to play with this.
As you note in your initial post, there is a problem in the fact that packagefile.xml records, in the case of a manually added package, the location of the actual lpk file used to install. And its position, wrt any examples is indeterminate. I have it working fine finding OPM packages, packagefile records the package top level directory then. Easy.
But to get the manually installed packages working is a lot harder. You seem to want to make an addition to the LPK format and add a section in the Lazarus->Project->Options->Miscellaneous (?) for the user to enter where they will store Examples. I suggest a lot milder change may be 'almost' as good ?
I know you (wp) manage LazMapViewer, in its lazmapviewerpkg.lpk file it has -
<CONFIG>
<Package Version="5">
....
<CompilerOptions>
<SearchPaths>
<OtherUnitFiles Value="source"/>
I use KControls, it has -
<CONFIG>
<Package Version="4">
....
<CompilerOptions>
<SearchPaths>
<OtherUnitFiles Value="..\..\source"/>
That is becoming a widely used syntax, one or two directories down from package root, there is a 'source' directory. In most cases, the sensible place to put some Examples is parallel to 'source'. (If its not called 'source', we could whatever is there, less happy with that.)
So, this would need no change to LPK format, no change to Project Options screen, will work for most, maybe almost all projects. Quick and easy. What do you think ?
Davo