[Development] Qt 4.8.6 Release Plans

Calogero Mauceri mauceri at actgate.com
Wed Oct 30 00:58:05 CET 2013


On 10/29/2013 9:01 PM, Sandy Martel wrote:
> Le 2013/10/30 à 5:24, Thiago Macieira <thiago.macieira at intel.com> a écrit :
>
>> On terça-feira, 29 de outubro de 2013 16:53:55, Calogero Mauceri wrote:
>>> For some reasons QApplication::applicationDirPath() works properly on OS
>>> X 10.9, but it returns the path to the app executable (the one inside
>>> the app bundle). I'm wondering whether a similar implementation could
>>> fix the issue for QDir::currentPath().
>> Please understand that the bug might be in your application.
>>
>> QDir::currentPath() returns the *current* path, not the bundle executable
>> path. On older OS X versions, if it returned the bundle executable path, it
>> was a quirk and depended on Finder behaviour. Depending on that behaviour was
>> irresponsible, because we all know that Apple likes to change behaviour and
>> break things.
>>
>> Now, is there something wrong with getcwd(3) on OS X 10.9? Can someone with
>> Mavericks test it? If it returns empty, then we conclude Apple broke their OS.
>> If it returns with error, what error is it?
>>
> Nothing wrong with getcwd (obviously). But it looks like the Finder now gives root as cwd for its children processes. I think this has always been an undefined behavior, subject to changes.
>
> Anyway, relying on the previous behavior was obviously a bug, if you launch from the Finder you get one cwd (whatever the Finder gives you), if you launch from the Terminal you get the cwd the shell gives you (most likely different) and your application doesn't work anymore.  There is an API to get the bundle's path and QApplication::applicationDirPath() uses it, so if you want QApplication::applicationDirPath(), don't use QDir::currentPath().
>
> Sandy.


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? 
(not the executable path as the QApplication::applicationDirPath() is 
returning)

Thanks,
     Calogero




More information about the Development mailing list