+ fix compiler warning
+ check for existence of directory before using it
This commit is contained in:
parent
999330f07b
commit
1408f0cd0a
|
@ -1910,12 +1910,14 @@ void Application::ExtractUserPath()
|
||||||
throw Base::Exception("Getting HOME path from system failed!");
|
throw Base::Exception("Getting HOME path from system failed!");
|
||||||
mConfig["UserHomePath"] = pwd->pw_dir;
|
mConfig["UserHomePath"] = pwd->pw_dir;
|
||||||
|
|
||||||
char *path="/tmp";
|
char *path = pwd->pw_dir;
|
||||||
char *FCUserData;
|
char *fc_user_data;
|
||||||
if (FCUserData=getenv("FREECAD_USER_DATA"))
|
if ((fc_user_data = getenv("FREECAD_USER_DATA"))) {
|
||||||
path = FCUserData;
|
QString env = QString::fromUtf8(fc_user_data);
|
||||||
else
|
QDir dir(env);
|
||||||
path = pwd->pw_dir;
|
if (!env.isEmpty() && dir.exists())
|
||||||
|
path = fc_user_data;
|
||||||
|
}
|
||||||
|
|
||||||
std::string appData(path);
|
std::string appData(path);
|
||||||
Base::FileInfo fi(appData.c_str());
|
Base::FileInfo fi(appData.c_str());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user