The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,466 other followers

Archive for August 21st, 2009

Delphi – getting the sourcefile name from a source file with an Assert trick using EAssertionFailed

Posted by jpluimers on 2009/08/21

For one of our projects, we have a set of configuration files that we want to be able to locate automatically.

(in this case they are XML files as most development environments have one way or the other to do some XML Data Binding that maps objects or interfaces to/from XML; in Delphi you can use the XML Data Binding Wizard for that: it has been there since Delphi 6, and CodeBeach has a nice Delphi XML data binding wizard video tuturoial on how to use that wizard)

We usually have a few instances of those config files hanging around:

  1. for testing; this one goes into the same directory as the Delphi source file generated by the XML Data Binding Wizard
  2. for the Delphi IDE (which might be relative to the Delphi IDE .exe)
  3. for the application (which usually is relative to the Appliation .EXE, or user settings directory)

If a specific version (higher numbers in the list above) does not exist, we want to revert to a more generic version (with lower numbre in the list above).
Ultimately we want to revert to the one for testing, which is in the subdirectory of a specific sourcefile.

Since all our development machines are configured in a similar way (i.e. having the same root path like C:\DEVELOP for our sources), it would be nice to be able to somehow automatically detect the file name of a source file.
Read the rest of this entry »

Posted in Delphi, Development | 3 Comments »

%d bloggers like this: