myxlib/examples/filesystem/01_minimal/minimal.cpp

52 lines
1.9 KiB
C++
Raw Normal View History

2019-11-25 12:08:34 +00:00
#include <myx/base/config.hpp>
#include <myx/filesystem/paths.hpp>
#include <myx/filesystem/paths_mt.hpp>
2019-11-25 12:08:34 +00:00
#include <QCoreApplication>
#include <QDebug>
2019-11-25 12:08:34 +00:00
2020-04-22 07:17:37 +00:00
#define CMLIB_PROJECT_NAME "myxlib"
namespace MF = myx::filesystem;
// Переменные для защиты экземпляра класса MF::PathsMT
std::atomic< MF::PathsMT* > MF::PathsMT::sInstance;
std::mutex MF::PathsMT::sMutex;
2020-04-22 07:17:37 +00:00
int main( int argc, char** argv )
{
(void)argc;
(void)argv;
QCoreApplication::setApplicationName( QStringLiteral( CMLIB_PROJECT_NAME ) );
MF::PathsMT& pathsMT = MF::PathsMT::instance();
MF::Paths& paths = MF::Paths::instance();
pathsMT.init( QStringLiteral( CMLIB_PROJECT_NAME ), QStringLiteral( "conf" ) );
pathsMT.findConfigFile( QStringLiteral( "test" ) );
qDebug() << pathsMT.systemLogDirectory();
qDebug() << pathsMT.systemConfigDirectory();
paths.init( QStringLiteral( CMLIB_PROJECT_NAME ), QStringLiteral( "conf" ) );
qDebug() << "executableName : " << paths.executableName();
qDebug() << "executableFilePath : " << paths.executableFilePath();
qDebug() << "executableDirectory : " << paths.executableDirectory();
qDebug() << "configFileName : " << paths.configFileName();
qDebug() << "configFilePath : " << paths.configFilePath();
qDebug() << "systemConfigDirectory : " << paths.systemConfigDirectory();
qDebug() << "systemConstDataDirectory : " << paths.systemConstDataDirectory();
qDebug() << "systemVarDataDirectory : " << paths.systemVarDataDirectory();
qDebug() << "systemLogDirectory : " << paths.systemLogDirectory();
qDebug() << "userConfigDirectory : " << paths.userConfigDirectory();
qDebug() << "userConstDataDirectory : " << paths.userConstDataDirectory();
qDebug() << "userVarDataDirectory : " << paths.userVarDataDirectory();
qDebug() << "userLogDirectory : " << paths.userLogDirectory();
return( 0 );
2020-05-15 17:14:21 +00:00
} // main