Переписан код для формирования путей к стандартным каталогам
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user