Потокобезопасная версия в отдельном классе и удаление лишних методов
This commit is contained in:
@ -3,25 +3,34 @@
|
||||
#include <myx/base/config.hpp>
|
||||
|
||||
#include <myx/filesystem/paths.hpp>
|
||||
#include <myx/filesystem/paths_mt.hpp>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
namespace MF = myx::filesystem;
|
||||
|
||||
// Переменные для защиты экземпляра класса MF::Paths
|
||||
std::atomic< MF::Paths* > MF::Paths::mInstance;
|
||||
std::mutex MF::Paths::mMutex;
|
||||
// Переменные для защиты экземпляра класса MF::PathsMT
|
||||
std::atomic< MF::PathsMT* > MF::PathsMT::mInstance;
|
||||
std::mutex MF::PathsMT::mMutex;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
QCoreApplication::setApplicationName( QStringLiteral( CMLIB_PROJECT_NAME ) );
|
||||
MF::Paths* paths = MF::Paths::getInstance();
|
||||
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" ) );
|
||||
paths->makeDefaultDirectories();
|
||||
paths->findConfigFile( QStringLiteral( "test" ) );
|
||||
qDebug() << paths->systemConstDataDirectory();
|
||||
qDebug() << paths->configFileName();
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
Reference in New Issue
Block a user