Стандартные пути
This commit is contained in:
43
src/myx/filesystem/current_executable.cpp
Normal file
43
src/myx/filesystem/current_executable.cpp
Normal 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
|
Reference in New Issue
Block a user