Правка условий поиска каталогов
This commit is contained in:
parent
c503edfe49
commit
dfacad2da1
@ -29,9 +29,23 @@ int main( int argc, char** argv )
|
|||||||
qDebug() << pathsMT.systemConfigDirectory();
|
qDebug() << pathsMT.systemConfigDirectory();
|
||||||
|
|
||||||
paths.init( QStringLiteral( CMLIB_PROJECT_NAME ), QStringLiteral( "conf" ) );
|
paths.init( QStringLiteral( CMLIB_PROJECT_NAME ), QStringLiteral( "conf" ) );
|
||||||
paths.findConfigFile( QStringLiteral( "test" ) );
|
|
||||||
qDebug() << paths.systemConstDataDirectory();
|
qDebug() << "executableName : " << paths.executableName();
|
||||||
qDebug() << paths.configFileName();
|
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 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ MYXLIB_INLINE void Paths::setupSystemDirectories( const QString& defaultEtcDirec
|
|||||||
const QString& defaultLogDirectory )
|
const QString& defaultLogDirectory )
|
||||||
{
|
{
|
||||||
QFileInfo etcDirInfo { defaultEtcDirectory };
|
QFileInfo etcDirInfo { defaultEtcDirectory };
|
||||||
if ( !etcDirInfo.isDir() || !etcDirInfo.isReadable() )
|
if ( etcDirInfo.isDir() && etcDirInfo.isReadable() )
|
||||||
{
|
{
|
||||||
m_systemConfigDirectory = defaultEtcDirectory;
|
m_systemConfigDirectory = defaultEtcDirectory;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ MYXLIB_INLINE void Paths::setupSystemDirectories( const QString& defaultEtcDirec
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo constDataDirInfo { defaultConstDataDirectory };
|
QFileInfo constDataDirInfo { defaultConstDataDirectory };
|
||||||
if ( !constDataDirInfo.isDir() || !constDataDirInfo.isReadable() )
|
if ( constDataDirInfo.isDir() && constDataDirInfo.isReadable() )
|
||||||
{
|
{
|
||||||
m_systemConstDataDirectory = defaultConstDataDirectory;
|
m_systemConstDataDirectory = defaultConstDataDirectory;
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ MYXLIB_INLINE void Paths::setupSystemDirectories( const QString& defaultEtcDirec
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo varDataDirInfo { defaultVarDataDirectory };
|
QFileInfo varDataDirInfo { defaultVarDataDirectory };
|
||||||
if ( !varDataDirInfo.isDir() || !varDataDirInfo.isWritable() )
|
if ( varDataDirInfo.isDir() && varDataDirInfo.isWritable() )
|
||||||
{
|
{
|
||||||
m_systemVarDataDirectory = defaultVarDataDirectory;
|
m_systemVarDataDirectory = defaultVarDataDirectory;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ MYXLIB_INLINE void Paths::setupSystemDirectories( const QString& defaultEtcDirec
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo logDirInfo { defaultLogDirectory };
|
QFileInfo logDirInfo { defaultLogDirectory };
|
||||||
if ( !logDirInfo.isDir() || !logDirInfo.isWritable() )
|
if ( logDirInfo.isDir() && logDirInfo.isWritable() )
|
||||||
{
|
{
|
||||||
m_systemLogDirectory = defaultLogDirectory;
|
m_systemLogDirectory = defaultLogDirectory;
|
||||||
}
|
}
|
||||||
@ -195,14 +195,14 @@ MYXLIB_INLINE bool Paths::makeDefaultDirectories()
|
|||||||
bool status = true;
|
bool status = true;
|
||||||
QDir dir;
|
QDir dir;
|
||||||
|
|
||||||
if (dir.mkpath( m_userConfigDirectory )) { status = false; };
|
if ( dir.mkpath( m_userConfigDirectory ) ) { status = false; }
|
||||||
if (dir.mkpath( m_userVarDataDirectory )) { status = false; };
|
if ( dir.mkpath( m_userVarDataDirectory ) ) { status = false; }
|
||||||
if (dir.mkpath( m_userConstDataDirectory )) { status = false; };
|
if ( dir.mkpath( m_userConstDataDirectory ) ) { status = false; }
|
||||||
if (dir.mkpath( m_userLogDirectory )) { status = false; };
|
if ( dir.mkpath( m_userLogDirectory ) ) { status = false; }
|
||||||
if (dir.mkpath( m_systemConfigDirectory )) { status = false; };
|
if ( dir.mkpath( m_systemConfigDirectory ) ) { status = false; }
|
||||||
if (dir.mkpath( m_systemVarDataDirectory )) { status = false; };
|
if ( dir.mkpath( m_systemVarDataDirectory ) ) { status = false; }
|
||||||
if (dir.mkpath( m_systemConstDataDirectory )) { status = false; };
|
if ( dir.mkpath( m_systemConstDataDirectory ) ) { status = false; }
|
||||||
if (dir.mkpath( m_systemLogDirectory )) { status = false; };
|
if ( dir.mkpath( m_systemLogDirectory ) ) { status = false; }
|
||||||
|
|
||||||
return( status );
|
return( status );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user