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

This commit is contained in:
2020-04-04 00:04:02 +03:00
parent 189d85719e
commit f87e6207d2
9 changed files with 244 additions and 216 deletions

View File

@ -9,34 +9,22 @@ namespace myx {
namespace filesystem {
#if !defined ( __linux__ )
error "Class CurrentExecutable is supported only in Linux"
#endif
CurrentExecutable::CurrentExecutable() :
m_procFilePath( QStringLiteral( "/proc/self/exe" ) )
{
auto canonicalFilePath = m_procFilePath.canonicalFilePath();
auto canonicalPath = m_procFilePath.canonicalPath();
m_fileName = canonicalFilePath.remove( canonicalPath ).remove( '/' );
m_canonicalFilePath = canonicalFilePath;
m_canonicalPath = canonicalPath;
m_canonicalFilePath = m_procFilePath.canonicalFilePath();
}
QFileInfo CurrentExecutable::canonicalFilePath() const
const QFileInfo& CurrentExecutable::canonicalFilePath() const
{
return( m_canonicalFilePath );
}
QDir CurrentExecutable::canonicalPath() const
{
return( m_canonicalPath );
}
QString CurrentExecutable::fileName() const
{
return( m_fileName );
}
} // namespace filesystem
} // namespace myx