I'm looking for a way to evaluate the $(ModuleName) macro in Project Options using the Open Tools API. Anyone know how?


I'm looking for a way to evaluate the $(ModuleName) macro in Project Options using the Open Tools API. Anyone know how?

Comments

  1. I’m not aware there is any OTA functions that will do this for you so you need to write a parser/replacer which looks for the macros (use regex) and then replace with the appropriate info. For BDS related macros you need to read some registry info. I wrote an article the other day on that and you will find them in BDSs environment block.

    ReplyDelete
  2. Yes, but replace with what? That's the entire problem. ModuleName (or anything that appears to be it, and it should change when the active project is changed) is not in the environment block. I may have to go with the project filename with .dpr removed, however I'm concerned that is not going to be reliable

    ReplyDelete
  3. Okay, wrong end of the stick. You need to look at the project options (IOTAOptionsOptions I think) and it’s members. In my ITHelper I use this to build a target name for the project. My stuff it on GitHub @ github.com - · GitHub and the project is call Integrated Testing Helper. Sorry for the lack of info I’m on a platform waiting for a train.

    ReplyDelete
  4. IOTAProject.ProjectOptions.TargetName. There is an example in Procedure TITHResponseFile.BuildTargetFileName(Const strBasePath: String); in the above project.. Note: the targetname can be modified in code, I’ve tried to handle the change of extension but LIBSUFFIX and the like can also change it.

    ReplyDelete
  5. Tried TargetName - unfortunately it is not the same thing. e.g. in an Android project, the $(ModuleName) can be SomeProject, TargetName is libSomeProject, and as you say, it can be modified

    ReplyDelete

Post a Comment