Menu

Macro in .dev files

Tony Reina
2005-04-24
2012-09-26
  • Tony Reina

    Tony Reina - 2005-04-24

    I've been helping out with wx-devcpp and came across something that I think would be useful for dev-cpp too.

    From what I can tell (and I could be completely off-base here), devpaks don't have any way to include macros in the .dev files that are changed to reflect the true dev-cpp installation directory. For example, if a user had installed dev-cpp in a non-default directory (e.g. c:\example), a devpak that includes .dev files hard-coded for c:\dev-cpp will not work. The change I made will parse .dev files for the macro %DEVCPP_DIR% and replace it with the actual dev-cpp installation directory.

    All I did was change project.pas like so:

    Line 895:
    fOptions.ResourceIncludes.DelimitedText := Read('ResourceIncludes', '');

    Change to:
    fOptions.ResourceIncludes.DelimitedText :=
    StringReplace(Read('ResourceIncludes', ''),
    '%DEVCPP_DIR%', devDirs.Default, [rfReplaceAll]);

    I can send the changes for people to review if this is of interest.

    -Tony

     
    • Marek Januszewski

      Tony,
      that functionality is in dev-c++ code already
      If you want to look for list of macros I believe it's in macros.pas
      as examples see my gtk examples devpak on devpaks.org

       
    • Tony Reina

      Tony Reina - 2005-04-25

      I see the code in macro.pas. It looks like <DEVCPP> should be replaced by the directory where devcpp was installed. However, when I add this to my .dev file, it does not get replaced.

      For example, in my .dev file, I added:
      ResourceIncludes=<DEVCPP>include

      However, when I load the project into DevCpp, it doesn't get replaced (I still see <DEVCPP>include in Project Options->Directories->Resource Directories).

      Is there something I'm missing here?
      -Tony

       
      • Marek Januszewski

        you need to lookup the code. it doesn't work for all windows
        afair: for includes it does, but for libs it does not.
        it needs to be fixed, one thing I'm almost positive is that we're not going to do that windows style (%), but unix style: $VARIABLE or ${SOME_VARIABLE}. Another option would be to evaluate it through some unix shell, that way things like wx-config --libs could work too

         

Log in to post a comment.