Стандартные пути

This commit is contained in:
2019-11-25 15:08:34 +03:00
parent daab07fa6a
commit d6c1e42a26
9 changed files with 126 additions and 468 deletions

View File

@ -0,0 +1,43 @@
#include "current_executable.hpp"
#include <myx/base/config.hpp>
#include <paths.h>
#include <QString>
#include <QCoreApplication>
namespace myx {
namespace filesystem {
CurrentExecutable::CurrentExecutable() :
m_procFilePath( "/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;
}
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