Environment variable blank inside application
- by Jake
I have an environment variable that I've set in ~/.profile with the following line:
export APPDIR=/path/to/dir
When I log in and load up a terminal, I can verify that the variable is set:
$ printenv APPDIR
/path/to/dir
I'm trying to access this variable from within a Qt application:
QString appdir = getenv("APPDIR");
QTWARNING("dir: |" + appdir + "|");
The warning window that pops up shows me:
dir: ||
What is going on here? Am I misunderstanding about how environment variables work in Ubuntu?
This is with a C++/Qt App on Ubuntu 11.10 x86.