: Thanks to both. I need this to keep some additional text data related to the application.
:
: Is it good to keep such data in the same directory with the .exe file or is there any other way to do this?
:
: (I don't want to use an absolute path like "C:\Program Files\My Applicaton\" because the user may want to install the application to some other location he/she wants)
:
: : : : hi;
: : : :
: : : : I want to obtain the exact directory which the executable itself resides in. I use the GetDir() procedure, but it returns the directory of the parameter file.
: : : :
: : : : Thanx...
: : : :
: : :
: : : Do you mean the path for your application itself ?
: : : I don't have Delphi here but it's in the Application component.
: : : Something like Application.ExeName if I remember right. And to obtain the path respectively you can use ExtractFilePath (not so sure about the name of the function either).
: : : Hope that helps.
: : :
: : You can also use the GetParam() function for that. The zeroth param is the complete exe-name including the path. This can also be used in a console application without the 400 kB forms overhead.
: :
:
:
Getting the exe-path in run-time is the best way to ensure that that data file is in the same directory as the exe-file. It also makes the program easier to remove from the system. If you have a lot of data, you might also consider using a subdirectory in the exe-directory. Most games use this method. That is also very easy to implement once you have the exe-path.