[DEV] add get binary directory

This commit is contained in:
Edouard DUPIN 2018-10-30 22:04:32 +01:00
parent 03c0b121e7
commit 408a3745bd
2 changed files with 11 additions and 1 deletions

View File

@ -196,6 +196,7 @@ bool etk::path::exist(const etk::Path& _path) {
uint64_t etk::path::fileSize(const etk::Path& _path) {
// Note : this is a proper methode to get the file size for Big files ... otherwithe the size is limited at 2^31 bytes
// tmpStat Buffer :
TK_VERBOSE(" file size of " << _path.getNative());
struct stat statProperty;
if (stat(_path.getNative().c_str(), &statProperty) == -1) {
//Normal case when the file does not exist ... ==> the it was in unknow mode ...
@ -425,6 +426,10 @@ etk::Path etk::path::getBinaryPath() {
return out;
}
etk::Path etk::path::getBinaryDirectory() {
return getBinaryPath().getParent();
}
etk::String etk::path::getBinaryName() {
return getBinaryPath().getFileName();
}

View File

@ -221,10 +221,15 @@ namespace etk {
*/
etk::String getBinaryName();
/**
* @brief Full banary name (with root path).
* @brief Full binary name (with root path and binamary name).
* @return the binary absolute path.
*/
etk::Path getBinaryPath();
/**
* @brief Full binary name (with root path) ==> without executable name.
* @return the binary absolute path.
*/
etk::Path getBinaryDirectory();
/**
* @brief Get the data path of the application.
* @return the root path of the data for this application.