[Development] Qt 4.8.6 Release Plans

Sandy Martel sandy.martel at gmail.com
Wed Oct 30 01:45:10 CET 2013


Le 2013/10/30 à 11:06, Nicolás Alvarez <nicolas.alvarez at gmail.com> a écrit :

> 2013/10/29 Calogero Mauceri <mauceri at actgate.com>:
>>> ...
>> 
>> 
>> The Qt documentation states that QDir::currentPath() returns "The
>> application working directory".  Shouldn't the workind directory be
>> initialized with the path the application was launched from? If that's
>> not the case, which is the right way to obtain the working directory?
> 
> That is the correct way to get the working directory. But there is no
> documentation from Apple guaranteeing what the working directory will
> be when Finder launches an application.

Calogero, I don't think "working" directory means exactly what you think it means. Also, as Nicolás says, "the path the application was launched from" means whatever the Finder wants it to be.

Looks like you want something like CFBundleCopyBundleURL(CFBundleGetMainBundle()) .

For Qt, I'd say QApplication::applicationDirPath() + ../../.. or Qt5's QStandardPaths::ApplicationsLocation are your best bets.

Sandy.




More information about the Development mailing list