c++ - QDir absolutePath on Mac -


im getting 2 different paths when run same build within qt creator , when double click on finder on mac.

here code:

qdir dir = qdir::currentpath(); dir.cdup(); dir.cdup(); dir.cdup(); qstring rootpath = dir.absolutepath();  

when run (debug) mode in qt creator path is:

/users/myuser/projects/appname/build/mac

when double click on file located on /users/myyser/projects/appname/build/mac finder returns / only.

why 2 different paths?

version: qt5.2.1

update

seems bug reading following urlhttp://qt-project.org/forums/viewthread/34019

why 2 different paths?

as write in thread linked, qdir::currentpath() not returns application directory. return path wherever application run, different application directory when running application command line, or "start menu" alike places , on.

if wish deal application directory navigate there, need use following method instead:

qstring qcoreapplication::applicationdirpath() [static]

returns directory contains application executable.

for example, if have installed qt in c:\qt directory, , run regexp example, function return "c:/qt/examples/tools/regexp".

on mac os x point directory containing executable, may inside of application bundle (if application bundled).

the last sentence clarifies mac os x case.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -