+ fix compiler warning

+ check for existence of directory before using it
This commit is contained in:
wmayer 2016-06-23 11:25:54 +02:00
parent 999330f07b
commit 1408f0cd0a

View File

@ -1910,12 +1910,14 @@ void Application::ExtractUserPath()
throw Base::Exception("Getting HOME path from system failed!");
mConfig["UserHomePath"] = pwd->pw_dir;
char *path="/tmp";
char *FCUserData;
if (FCUserData=getenv("FREECAD_USER_DATA"))
path = FCUserData;
else
path = pwd->pw_dir;
char *path = pwd->pw_dir;
char *fc_user_data;
if ((fc_user_data = getenv("FREECAD_USER_DATA"))) {
QString env = QString::fromUtf8(fc_user_data);
QDir dir(env);
if (!env.isEmpty() && dir.exists())
path = fc_user_data;
}
std::string appData(path);
Base::FileInfo fi(appData.c_str());