mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Add ServerPathUtils
This commit is contained in:
parent
12fc446d2c
commit
a43b9ba2c3
2 changed files with 38 additions and 0 deletions
16
libraries/shared/src/ServerPathUtils.cpp
Normal file
16
libraries/shared/src/ServerPathUtils.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "ServerPathUtils.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
#include <QtCore/QDir>
|
||||
|
||||
QString ServerPathUtils::getDataDirectory() {
|
||||
auto directory = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
if (directory.isEmpty()) {
|
||||
directory = '.';
|
||||
}
|
||||
return directory;
|
||||
}
|
||||
|
||||
QString ServerPathUtils::getDataFilePath(QString filename) {
|
||||
return QDir(getDataDirectory()).absoluteFilePath(filename);
|
||||
}
|
22
libraries/shared/src/ServerPathUtils.h
Normal file
22
libraries/shared/src/ServerPathUtils.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// ServerPathUtils.h
|
||||
// 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
|
||||
//
|
||||
|
||||
#ifndef hifi_ServerPathUtils_h
|
||||
#define hifi_ServerPathUtils_h
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace ServerPathUtils {
|
||||
QString getDataDirectory();
|
||||
QString getDataFilePath(QString filename);
|
||||
}
|
||||
|
||||
#endif // hifi_ServerPathUtils_h
|
Loading…
Reference in a new issue