[Development] Qt 4.8.6 Release Plans

Sandy Martel sandy.martel at gmail.com
Tue Oct 29 21:01:18 CET 2013


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.

> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list