Commit 8ac55e59 authored by Michał Glinka's avatar Michał Glinka

Add handling of missing HOME env

+ drawapp.cpp : added checking if env HOME exists
+ if not draw3 is launched in read-only mode for user drawdefinable sets
parent a3e85ab5
......@@ -314,9 +314,19 @@ bool DrawApp::OnInit() {
//wxLog *logger = new wxLogGui();
wxLog::SetActiveTarget(logger);
std::string home_path = getenv("HOME");
m_instance = std::make_unique<FileLocker>(home_path + "/.draw3_defined_lock");
m_instance->checkLockCorrectness();
if(getenv("HOME") != nullptr) {
std::string home_path = getenv("HOME");
if(home_path.empty() == false) {
m_instance = std::make_unique<FileLocker>(home_path + "/.draw3_defined_lock");
m_instance->checkLockCorrectness();
}
else {
m_instance = nullptr;
}
}
else {
m_instance = nullptr;
}
SetMaxCoreDumpLimit();
InitGL();
......@@ -607,6 +617,11 @@ bool DrawApp::OnCmdLineParsed(wxCmdLineParser &parser) {
}
void DrawApp::CheckActiveInstance() {
if(m_instance == nullptr) {
read_only = true;
return;
}
if (m_instance->tryLocking()) {
read_only = false;
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment