[DEBUG] node::touch and special int to string convertion
This commit is contained in:
parent
dffd6233d3
commit
4ffe6c3427
@ -136,11 +136,11 @@ etk::UString::UString(char inputData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::UString::UString(int inputData)
|
etk::UString::UString(int inputData, const char* mode)
|
||||||
{
|
{
|
||||||
char tmpVal[256];
|
char tmpVal[256];
|
||||||
// generate the UString :
|
// generate the UString :
|
||||||
sprintf(tmpVal, "%d", inputData);
|
sprintf(tmpVal, mode, inputData);
|
||||||
// set the internal data :
|
// set the internal data :
|
||||||
m_data.Clear();
|
m_data.Clear();
|
||||||
m_data.PushBack('\0');
|
m_data.PushBack('\0');
|
||||||
@ -148,11 +148,11 @@ etk::UString::UString(int inputData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::UString::UString(unsigned int inputData)
|
etk::UString::UString(unsigned int inputData, const char* mode)
|
||||||
{
|
{
|
||||||
char tmpVal[256];
|
char tmpVal[256];
|
||||||
// generate the UString :
|
// generate the UString :
|
||||||
sprintf(tmpVal, "%d", inputData);
|
sprintf(tmpVal, mode, inputData);
|
||||||
// set the internal data :
|
// set the internal data :
|
||||||
m_data.Clear();
|
m_data.Clear();
|
||||||
m_data.PushBack('\0');
|
m_data.PushBack('\0');
|
||||||
|
@ -27,8 +27,8 @@ namespace etk
|
|||||||
void Set(const char* inputData, int32_t len=-1);
|
void Set(const char* inputData, int32_t len=-1);
|
||||||
// basic convertion integer en string
|
// basic convertion integer en string
|
||||||
UString(char inputData);
|
UString(char inputData);
|
||||||
UString(int inputData);
|
UString(int inputData, const char* mode="%d");
|
||||||
UString(unsigned int inputData);
|
UString(unsigned int inputData, const char* mode="%d");
|
||||||
UString(float inputData);
|
UString(float inputData);
|
||||||
UString(double inputData);
|
UString(double inputData);
|
||||||
UString(const etk::UString &etkS);
|
UString(const etk::UString &etkS);
|
||||||
|
@ -863,6 +863,7 @@ etk::UString etk::FSNode::GetRelativeFolder(void) const
|
|||||||
|
|
||||||
bool etk::FSNode::Touch(void)
|
bool etk::FSNode::Touch(void)
|
||||||
{
|
{
|
||||||
|
TK_DEBUG("Touch FILE : " << GetName());
|
||||||
//just open in write an close ==> this will update the time
|
//just open in write an close ==> this will update the time
|
||||||
if (false==FileOpenAppend()) {
|
if (false==FileOpenAppend()) {
|
||||||
return false;
|
return false;
|
||||||
@ -872,6 +873,21 @@ bool etk::FSNode::Touch(void)
|
|||||||
UpdateFileSystemProperty();
|
UpdateFileSystemProperty();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool etk::FSNode::Move(const etk::UString& path)
|
||||||
|
{
|
||||||
|
etk::FSNode tmpDst(path);
|
||||||
|
if (tmpDst.Exist()==true) {
|
||||||
|
tmpDst.Remove();
|
||||||
|
}
|
||||||
|
int32_t res = rename(GetName().c_str(), tmpDst.GetName().c_str());
|
||||||
|
if (res!=0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool etk::FSNode::Remove(void)
|
bool etk::FSNode::Remove(void)
|
||||||
{
|
{
|
||||||
if (GetNodeType()==etk::FSN_FOLDER) {
|
if (GetNodeType()==etk::FSN_FOLDER) {
|
||||||
@ -1288,6 +1304,7 @@ bool etk::FSNode::FileOpenRead(void)
|
|||||||
TK_CRITICAL("File Already open : " << *this);
|
TK_CRITICAL("File Already open : " << *this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
TK_VERBOSE(" Read file : " << m_systemFileName);
|
||||||
m_PointerFile=fopen(m_systemFileName.c_str(),"rb");
|
m_PointerFile=fopen(m_systemFileName.c_str(),"rb");
|
||||||
if(NULL == m_PointerFile) {
|
if(NULL == m_PointerFile) {
|
||||||
TK_ERROR("Can not find the file " << *this );
|
TK_ERROR("Can not find the file " << *this );
|
||||||
@ -1308,6 +1325,7 @@ bool etk::FSNode::FileOpenWrite(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
FSNODE_LOCAL_mkPath(GetNameFolder().c_str() , 0777);
|
FSNODE_LOCAL_mkPath(GetNameFolder().c_str() , 0777);
|
||||||
|
TK_VERBOSE(" write file : " << m_systemFileName);
|
||||||
m_PointerFile=fopen(m_systemFileName.c_str(),"wb");
|
m_PointerFile=fopen(m_systemFileName.c_str(),"wb");
|
||||||
if(NULL == m_PointerFile) {
|
if(NULL == m_PointerFile) {
|
||||||
TK_ERROR("Can not find the file " << *this);
|
TK_ERROR("Can not find the file " << *this);
|
||||||
@ -1329,6 +1347,8 @@ bool etk::FSNode::FileOpenAppend(void)
|
|||||||
}
|
}
|
||||||
FSNODE_LOCAL_mkPath(GetNameFolder().c_str() , 0777);
|
FSNODE_LOCAL_mkPath(GetNameFolder().c_str() , 0777);
|
||||||
|
|
||||||
|
TK_VERBOSE(" append file : " << m_systemFileName);
|
||||||
|
|
||||||
m_PointerFile=fopen(m_systemFileName.c_str(),"ab");
|
m_PointerFile=fopen(m_systemFileName.c_str(),"ab");
|
||||||
if(NULL == m_PointerFile) {
|
if(NULL == m_PointerFile) {
|
||||||
TK_ERROR("Can not find the file " << *this);
|
TK_ERROR("Can not find the file " << *this);
|
||||||
@ -1600,6 +1620,18 @@ bool etk::FSNodeExist(const etk::UString& path)
|
|||||||
return tmpNode.Exist();
|
return tmpNode.Exist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool etk::FSNodeMove(const etk::UString& path1, const etk::UString& path2)
|
||||||
|
{
|
||||||
|
etk::FSNode tmpNode(path1);
|
||||||
|
if (false==tmpNode.Exist()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// no check error in every case
|
||||||
|
(void)etk::FSNodeRemove(path2);
|
||||||
|
//move the node
|
||||||
|
return tmpNode.Move(path2);
|
||||||
|
}
|
||||||
|
|
||||||
etk::FSNodeRight etk::FSNodeGetRight(const etk::UString& path)
|
etk::FSNodeRight etk::FSNodeGetRight(const etk::UString& path)
|
||||||
{
|
{
|
||||||
etk::FSNode tmpNode(path);
|
etk::FSNode tmpNode(path);
|
||||||
@ -1630,12 +1662,9 @@ uint64_t etk::FSNodeGetTimeAccessed(const etk::UString& path)
|
|||||||
return tmpNode.TimeAccessed();
|
return tmpNode.TimeAccessed();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t etk::FSNodeTouch(const etk::UString& path)
|
bool etk::FSNodeTouch(const etk::UString& path)
|
||||||
{
|
{
|
||||||
etk::FSNode tmpNode(path);
|
etk::FSNode tmpNode(path);
|
||||||
if (false==tmpNode.Exist()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return tmpNode.Touch();
|
return tmpNode.Touch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +233,13 @@ namespace etk
|
|||||||
* @return false : action not done
|
* @return false : action not done
|
||||||
*/
|
*/
|
||||||
bool Touch(void);
|
bool Touch(void);
|
||||||
|
/**
|
||||||
|
* @brief Move the Node at a new path
|
||||||
|
* @param[in] path The new path
|
||||||
|
* @return true : action done
|
||||||
|
* @return false : action not done
|
||||||
|
*/
|
||||||
|
bool Move(const etk::UString& path);
|
||||||
/**
|
/**
|
||||||
* @brief Get the node type (DATA/DIRECT...)
|
* @brief Get the node type (DATA/DIRECT...)
|
||||||
* @return the requested type
|
* @return the requested type
|
||||||
@ -498,6 +505,14 @@ namespace etk
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
bool FSNodeExist(const etk::UString& path);
|
bool FSNodeExist(const etk::UString& path);
|
||||||
|
/**
|
||||||
|
* @brief Simple access for : chexk the exestance of an element
|
||||||
|
* @param[in] path Folder/File/Pipe path of the node sources
|
||||||
|
* @param[in] path Folder/File/Pipe path of the node destination
|
||||||
|
* @return true : Action done corectly
|
||||||
|
* @return false : An error occured
|
||||||
|
*/
|
||||||
|
bool FSNodeMove(const etk::UString& path1, const etk::UString& path2);
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Get right of the current Node
|
* @brief Simple access for : Get right of the current Node
|
||||||
* @param[in] path Folder/File/Pipe path of the node
|
* @param[in] path Folder/File/Pipe path of the node
|
||||||
@ -539,7 +554,7 @@ namespace etk
|
|||||||
* @return true : Action done corectly
|
* @return true : Action done corectly
|
||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
*/
|
*/
|
||||||
uint64_t FSNodeTouch(const etk::UString& path);
|
bool FSNodeTouch(const etk::UString& path);
|
||||||
/**
|
/**
|
||||||
* @brief Simple access for : Basic write on the node (like console echo)
|
* @brief Simple access for : Basic write on the node (like console echo)
|
||||||
* @param[in] path Folder/File/Pipe path of the node
|
* @param[in] path Folder/File/Pipe path of the node
|
||||||
|
Loading…
x
Reference in New Issue
Block a user