Reputation: 76753
I want to extend GPProfile so it also works with XE2.
The problem why it does not is that it does not know how to translate the file path in XE2's .dproj file.
The following error occurs:
Exception class EOSError with message TGpHugeFile.AccessFile(C:\Users\Johan\Documents\RAD Studio\Projects\project8\ $(Platform)\$(Config) \Project8.gpd) failed. Win32 Error. Code: 3. System cannot find the given path.'
The program extracts the path, but does not know how to translate the $platform
and $config
variables.
Whilst it's easy enough to hardcode these vars to Win32/Win64
and Release/Debug
respectively, I'd like to do it properly. By which I mean that I want to extract the values that the IDE saves to the .dproj file which are the selected values of the variables when the files is saved.
How do I extract the these values from the .dproj
file?
Upvotes: 1
Views: 4341
Reputation: 613592
You can work this out with a little reverse engineering. Take a default project and add the Win64 platform. Then save the .dproj file. Then change the values of both platform and config, and save another .dproj file. Then run these files through a difference program. The output looks like this:
8,9c8,9
< <Config Condition="'$(Config)'==''">Debug</Config>
< <Platform Condition="'$(Platform)'==''">Win32</Platform>
---
> <Config Condition="'$(Config)'==''">Release</Config>
> <Platform Condition="'$(Platform)'==''">Win64</Platform>
Now that you know where the values live, it's just a simple XML parsing task to extract them from the file.
Now for a rant. If anyone from Emba reads this, would it be possible to change the program to store the settings from the IDE in a different file? Perhaps named .dproj.local or .dproj. or similar. That would allow us to commit the .dproj file to revision control and not have it show up as modified every time we switch platforms for a debugging session.
Upvotes: 4
Reputation: 598384
$(Platform)
, $(Config)
and other $(...)
environment variables are set by the compiler when the project is being compiled. The .dproj contains paths that get translated dynamically during compiling. If you need to extract the paths and do something with them, you will have to manually translate the environment variables yourself before then using the final translated paths. You will likely need to have GPProfile prompt the user for the relevant Platform/Config values as needed.
Upvotes: 1