[ RESOLVED ] New in 4.7.4: QDir::homePath() gives out empty string



  • @QString path = QDir::homePath(); // <-- "path" is always ""@

    Is this a new bug in 4.7.4? use to work well in 4.7.3.
    I'm on OSX Lion (4.7.3 worked on Lion well).



  • Hmmm It seems the problem is resolved if I don't use the "Clear System Environment". I unchecked it, then re-built and it worked fine.

    could it be the "SHELL" definitions? I can't think of anything other than that that's remotely related to this. I guess something caused Qt to have "QT_NO_FSFILEENGINE" defined and thus to return an empty string:

    @// from Qt source: QDir.cpp

    QString QDirPrivate()
    {
    #ifdef QT_NO_FSFILEENGINE
    return QString();
    #else
    return cleanPath(QFSFileEngine::homePath());
    #endif
    }@



  • The homePath is the content of the HOME environment variable on unix-like systems (this includes Mac OS X). If you clear the environment, that variable is reset too, so the home path is empty.



  • So, the "Clear system Environment" in Qt-Creator, causes those environment parameters to be "invisible" at runtime, for my system? If I deployed that same app on another machine, it would have been able to figure out the HOME string, right?



  • [quote author="ronM71" date="1315349947"]So, the "Clear system Environment" in Qt-Creator, causes those environment parameters to be "invisible" at runtime, for my system? If I deployed that same app on another machine, it would have been able to figure out the HOME string, right?[/quote]

    Yes, so it is.

    Instead of "Clear system Environment" you could just override it and reset or adjust the settings of some of the variables. Or just set the HOME variable to its original value (usually /Users/username on the Mac, with username being the short name, not the full name).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.