Add prototype for binary directory functions

This commit is contained in:
Vasily
2019-03-19 16:10:35 +01:00
committed by username223
parent b770d869ae
commit ac4a124450
+25 -7
View File
@@ -1,19 +1,37 @@
#include "paths.h"
#include <QStandardPaths>
#include <QString>
#include <easylogging++.h>
namespace paths
{
optional<string> binaryDirectory()
{
const auto binaryDir
const auto path
= QStandardPaths::writableLocation( QStandardPaths::AppDataLocation );
if ( binaryDir != "" )
if ( path == "" )
{
return binaryDir.toStdString();
}
else
{
return {};
LOG( ERROR ) << "Could not find binary directory.";
return std::nullopt;
}
return path.toStdString();
}
optional<string> binaryDirectoryFindFile( const string fileName )
{
const auto path = QStandardPaths::locate(
QStandardPaths::AppDataLocation, QString::fromStdString( fileName ) );
if ( path == "" )
{
LOG( ERROR ) << "Could not find file '" << fileName
<< "' in binary directory.";
return std::nullopt;
}
return path.toStdString();
}
} // namespace paths