mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
Write and delete "application is running" marker file
This commit is contained in:
parent
07c9a0e2bb
commit
63ad972576
3 changed files with 73 additions and 0 deletions
|
@ -104,6 +104,7 @@
|
|||
#include <RenderableWebEntityItem.h>
|
||||
|
||||
#include "AudioClient.h"
|
||||
#include "CrashHandler.h"
|
||||
#include "DiscoverabilityManager.h"
|
||||
#include "GLCanvas.h"
|
||||
#include "LODManager.h"
|
||||
|
@ -256,6 +257,9 @@ bool setupEssentials(int& argc, char** argv) {
|
|||
// Set build version
|
||||
QCoreApplication::setApplicationVersion(BUILD_VERSION);
|
||||
|
||||
CrashHandler::writeRunningMarkerFiler();
|
||||
qAddPostRoutine(CrashHandler::deleteRunningMarkerFile);
|
||||
|
||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||
DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
|
||||
DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
|
||||
|
|
42
interface/src/CrashHandler.cpp
Normal file
42
interface/src/CrashHandler.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// CrashHandler.cpp
|
||||
// interface/src
|
||||
//
|
||||
// Created by David Rowe on 24 Aug 2015.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "CrashHandler.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <PathUtils.h>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
|
||||
|
||||
void CrashHandler::writeRunningMarkerFiler() {
|
||||
QFile runningMarkerFile(runningMarkerFilePath());
|
||||
if (!runningMarkerFile.exists()) {
|
||||
runningMarkerFile.open(QIODevice::WriteOnly);
|
||||
runningMarkerFile.close();
|
||||
}
|
||||
}
|
||||
void CrashHandler::deleteRunningMarkerFile() {
|
||||
QFile runningMarkerFile(runningMarkerFilePath());
|
||||
if (runningMarkerFile.exists()) {
|
||||
runningMarkerFile.remove();
|
||||
}
|
||||
}
|
||||
|
||||
const QString CrashHandler::runningMarkerFilePath() {
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
applicationInfo.beginGroup("INFO");
|
||||
QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString());
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + RUNNING_MARKER_FILENAME;
|
||||
}
|
27
interface/src/CrashHandler.h
Normal file
27
interface/src/CrashHandler.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// CrashHandler.h
|
||||
// interface/src
|
||||
//
|
||||
// Created by David Rowe on 24 Aug 2015.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_CrashHandler_h
|
||||
#define hifi_CrashHandler_h
|
||||
|
||||
#include <QString>
|
||||
|
||||
class CrashHandler {
|
||||
|
||||
public:
|
||||
static void writeRunningMarkerFiler();
|
||||
static void deleteRunningMarkerFile();
|
||||
|
||||
private:
|
||||
static const QString runningMarkerFilePath();
|
||||
};
|
||||
|
||||
#endif // hifi_CrashHandler_h
|
Loading…
Reference in a new issue