[DEV] add auto set of the binary as default application name

This commit is contained in:
Edouard DUPIN 2016-04-28 22:05:24 +02:00
parent 33d985fcac
commit d56c8b57c7
2 changed files with 4 additions and 5 deletions

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file) * @license APACHE v2.0 (see license file)
*/ */
@ -14,7 +12,7 @@
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
void etk::init(int _argc, const char** _argv) { void etk::init(int _argc, const char** _argv) {
TK_INFO("E-TK system init (BEGIN)"); TK_INFO("E-TK system init (BEGIN) " << _argv[0]);
elog::init(_argc, _argv); elog::init(_argc, _argv);
etk::setArgZero(_argv[0]); etk::setArgZero(_argv[0]);
for (int32_t iii=0; iii<_argc ; ++iii) { for (int32_t iii=0; iii<_argc ; ++iii) {

View File

@ -1,8 +1,6 @@
/** @file /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file) * @license APACHE v2.0 (see license file)
*/ */
@ -215,6 +213,9 @@ std::string l_argZero = "";
void etk::setArgZero(const std::string& _val) { void etk::setArgZero(const std::string& _val) {
std::unique_lock<std::mutex> lock(getNodeMutex()); std::unique_lock<std::mutex> lock(getNodeMutex());
l_argZero = _val; l_argZero = _val;
// set defaiult application name ...
std::vector<std::string> elems = etk::split(_val, '/');
etk::initDefaultFolder(elems[elems.size()-1].c_str());
} }
/* /*
On Unixes with /proc really straight and realiable way is to: On Unixes with /proc really straight and realiable way is to: