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

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
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -314,9 +314,19 @@ bool DrawApp::OnInit() {
	//wxLog *logger = new wxLogGui();
	wxLog::SetActiveTarget(logger);

	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 {