Упрощение и правка автоопределения в /opt
This commit is contained in:
parent
360b2b41d1
commit
a29cea6f61
@ -14,8 +14,8 @@ namespace myx {
|
|||||||
namespace filesystem {
|
namespace filesystem {
|
||||||
|
|
||||||
MYXLIB_INLINE Paths::Paths() :
|
MYXLIB_INLINE Paths::Paths() :
|
||||||
m_binDirRegex ( "/s*bin$" ),
|
m_binDirRegex ( QStringLiteral( "/s*bin$" ) ),
|
||||||
m_unityBinDirRegex( "/bin/unity$" )
|
m_unityBinDirRegex( QStringLiteral( "/bin/unity$" ) )
|
||||||
{
|
{
|
||||||
QFileInfo procSelfExe( QStringLiteral( "/proc/self/exe" ) );
|
QFileInfo procSelfExe( QStringLiteral( "/proc/self/exe" ) );
|
||||||
QFileInfo currentExecutable = procSelfExe.canonicalFilePath();
|
QFileInfo currentExecutable = procSelfExe.canonicalFilePath();
|
||||||
@ -211,11 +211,11 @@ MYXLIB_INLINE void Paths::calculatePaths( HierarchyType hType )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HierarchyType::kHome:
|
case HierarchyType::kHome:
|
||||||
m_projectDirectory = m_homeDirectory;
|
setupSystemDirectories( m_homeDirectory,
|
||||||
m_systemConfigDirectory = m_userConfigDirectory;
|
m_userConfigDirectory,
|
||||||
m_systemConstDataDirectory = m_userConstDataDirectory;
|
m_userConstDataDirectory,
|
||||||
m_systemVarDataDirectory = m_userVarDataDirectory;
|
m_userVarDataDirectory,
|
||||||
m_systemLogDirectory = m_userLogDirectory;
|
m_userLogDirectory );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HierarchyType::kDevelopment:
|
case HierarchyType::kDevelopment:
|
||||||
@ -241,30 +241,29 @@ MYXLIB_INLINE void Paths::processOptHierarhy()
|
|||||||
|
|
||||||
if ( m_autodetect )
|
if ( m_autodetect )
|
||||||
{
|
{
|
||||||
QRegularExpression regex( "^/opt/(.+?)-(.+?)/(.+?)/" );
|
QRegularExpression regex( QStringLiteral( "^/opt/(.+?)/(.+?)/" ) );
|
||||||
QRegularExpressionMatch match = regex.match( m_executableDirectory );
|
QRegularExpressionMatch match = regex.match( m_executableDirectory );
|
||||||
if ( match.hasMatch() )
|
|
||||||
{
|
|
||||||
m_organizationName = match.captured( 1 );
|
|
||||||
m_themeName = match.captured( 2 );
|
|
||||||
m_projectName = match.captured( 3 );
|
|
||||||
|
|
||||||
QRegularExpression vr( "(.+?)\\.(.+)" );
|
|
||||||
QRegularExpressionMatch vm = vr.match( m_themeName );
|
|
||||||
if ( vm.hasMatch() )
|
|
||||||
{
|
|
||||||
m_themeName = vm.captured( 1 );
|
|
||||||
m_version = vm.captured( 2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
regex.setPattern( "^/opt/(.+?)/(.+?)/" );
|
|
||||||
match = regex.match( m_executableDirectory );
|
|
||||||
if ( match.hasMatch() )
|
if ( match.hasMatch() )
|
||||||
{
|
{
|
||||||
m_organizationName = match.captured( 1 );
|
m_organizationName = match.captured( 1 );
|
||||||
m_projectName = match.captured( 2 );
|
m_projectName = match.captured( 2 );
|
||||||
|
|
||||||
|
QRegularExpression themeRegex( QStringLiteral( "(.+?)-(.+)" ) );
|
||||||
|
QRegularExpressionMatch themeMatch = themeRegex.match( m_organizationName );
|
||||||
|
if ( themeMatch.hasMatch() )
|
||||||
|
{
|
||||||
|
m_themeName = themeMatch.captured( 2 );
|
||||||
|
m_organizationName = themeMatch.captured( 1 );
|
||||||
|
m_systemThemeDirectory = "/opt/" + m_organizationName + "-" + m_themeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QRegularExpression versionRegex( QStringLiteral( "(.+?)\\.(.+)" ) );
|
||||||
|
QRegularExpressionMatch versionMatch = versionRegex.match( m_projectName );
|
||||||
|
if ( versionMatch.hasMatch() )
|
||||||
|
{
|
||||||
|
m_projectName = versionMatch.captured( 1 );
|
||||||
|
m_version = versionMatch.captured( 2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user