[Qt-interest] How to avoid absolute file locations

Samuel G samuel857 at gmail.com
Sun Jan 11 16:52:13 CET 2009


On Sat, Jan 10, 2009 at 3:11 PM, Alan M. Carroll
<amc at network-geographics.com> wrote:
> What I would do is presume a fixed relative structure. E.g. there is an app directory under which is a "bin" directory and "data" directory. The QT application goes in "bin" and the data files in "data".
>
> The code can use the QCoreApplication::applicationDirPath() static method to get the path to the executable. From that it's trivial to back track up to the application root directory then down to the "data" directory. With this set up, you can create a tar ball which will work no matter where in the file system it is unpacked.
>

Neat. But after using QCoreApplication::applicationDirPath() it
would seem one would always be nervous about not having tested on
the particular OS others are using.



More information about the Qt-interest-old mailing list