Add ServerPathUtils

This commit is contained in:
Ryan Huffman 2016-01-14 12:55:32 -08:00
parent 12fc446d2c
commit a43b9ba2c3
2 changed files with 38 additions and 0 deletions

View 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);
}

View 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