mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Update ServerPathUtils::getDataDirectory to use custom path lookup
This commit is contained in:
parent
a27d35566d
commit
de36f3eeb2
1 changed files with 26 additions and 5 deletions
|
@ -1,16 +1,37 @@
|
|||
//
|
||||
// ServerPathUtils.cpp
|
||||
// libraries/shared/src
|
||||
//
|
||||
// Created by Ryan Huffman on 01/12/16.
|
||||
// Copyright 2016 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 "ServerPathUtils.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtWidgets/qapplication.h>
|
||||
#include <QDebug>
|
||||
|
||||
QString ServerPathUtils::getDataDirectory() {
|
||||
auto directory = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
if (directory.isEmpty()) {
|
||||
directory = '.';
|
||||
}
|
||||
return directory;
|
||||
auto homeDirectory = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
homeDirectory.cd("AppData/Roaming/");
|
||||
#elif Q_OS_OSX
|
||||
homeDirectory.cd("Library/Application Support/");
|
||||
#else
|
||||
homeDirectory.cd(".local/share/");
|
||||
#endif
|
||||
|
||||
homeDirectory.cd(qApp->organizationName() + "/" + qApp->applicationName());
|
||||
|
||||
return homeDirectory.absolutePath();
|
||||
}
|
||||
|
||||
QString ServerPathUtils::getDataFilePath(QString filename) {
|
||||
return QDir(getDataDirectory()).absoluteFilePath(filename);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue