Правка определения путей для исполняемого файла в каталоге /opt

This commit is contained in:
Andrei Astafev 2020-04-04 14:14:00 +03:00
parent d687dd8e98
commit a1d34d4c32

View File

@ -23,18 +23,21 @@ Paths::HierarchyType Paths::getHierarchyType()
return ( HierarchyType::kFlat );
}
if ( binaryDir.startsWith( "/opt" ) )
QRegExp optRegexp( "^/opt(/|/.+/)" + m_projectName + "/" );
if ( optRegexp.indexIn( binaryDir ) >= 0 )
{
QFileInfo etcDirInfo { "/opt/" + m_projectName + "/etc" };
binaryDir.remove( binRegexp );
QFileInfo etcDirInfo { binaryDir + "/etc" };
if ( !etcDirInfo.isDir() || !etcDirInfo.isReadable() ) { return( HierarchyType::kFlat ); }
QFileInfo constDataDirInfo { "/opt/" + m_projectName + "/files/data" };
QFileInfo constDataDirInfo { binaryDir + "/files/data" };
if ( !constDataDirInfo.isDir() || !constDataDirInfo.isReadable() ) { return( HierarchyType::kFlat ); }
QFileInfo varDataDirInfo { "/opt/" + m_projectName + "/files/lib" };
QFileInfo varDataDirInfo { binaryDir + "/files/lib" };
if ( !varDataDirInfo.isDir() || !varDataDirInfo.isWritable() ) { return( HierarchyType::kFlat ); }
QFileInfo logDirInfo { "/opt/" + m_projectName + "/files/log" };
QFileInfo logDirInfo { binaryDir + "/files/log" };
if ( !logDirInfo.isDir() || !logDirInfo.isWritable() ) { return( HierarchyType::kFlat ); }
m_systemConfigDirectory = etcDirInfo.canonicalFilePath();