[DEV] correction of the / path detection as root instead of relative

This commit is contained in:
Edouard DUPIN 2013-05-21 18:15:34 +02:00
parent b433625df8
commit 22dd6c01aa
3 changed files with 19 additions and 8 deletions

View File

@ -294,7 +294,7 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
int32_t i;
tmpFind=false;
for (i=0; i<m_data.Size(); i++) {
if (_data[_currentPos+j] == m_data[i]) {
if (m_data[i] == _data[_currentPos+j]) {
_findLen += 1;
tmpFind=true;
break;
@ -1175,7 +1175,7 @@ template<class CLASS_TYPE> class RegExp
* @brief Constructor
* @param[in,out] _exp Regular expression to parse
*/
RegExp(const etk::UString &_exp) :
RegExp(const etk::UString &_exp="") :
m_expressionRequested(""),
m_isOk(false),
m_notBeginWithChar(false),
@ -1356,7 +1356,7 @@ template<class CLASS_TYPE> class RegExp
bool Process( const CLASS_TYPE& _SearchIn,
int32_t _startPos,
int32_t _endPos,
char _escapeChar=0)
etk::UniChar _escapeChar=0)
{
if (false == m_isOk) {
return false;
@ -1391,7 +1391,7 @@ template<class CLASS_TYPE> class RegExp
if( _escapeChar != 0
&& i>0)
{
if ((char)_SearchIn[i-1] == _escapeChar) {
if (_escapeChar == _SearchIn[i-1]) {
//==> detected escape char ==> try find again ...
continue;
}
@ -1435,7 +1435,7 @@ template<class CLASS_TYPE> class RegExp
bool ProcessOneElement( const CLASS_TYPE& _SearchIn,
int32_t _startPos,
int32_t _endPos,
char _escapeChar=0)
etk::UniChar _escapeChar=0)
{
if (false == m_isOk) {
return false;
@ -1468,7 +1468,7 @@ template<class CLASS_TYPE> class RegExp
if( _escapeChar != 0
&& _startPos>0)
{
if (_SearchIn[_startPos-1] == _escapeChar) {
if (_escapeChar == _SearchIn[_startPos-1]) {
//==> detected escape char ==> try find again ...
return false;
}

View File

@ -144,7 +144,7 @@ namespace etk
void Remove(int32_t _currentID, int32_t _len);
void Clear(void);
etk::Vector<uniChar_t> GetVector(void);
etk::Vector<etk::UniChar> GetVector(void);
uniChar_t* pointer(void) { return &m_data[0]; };
etk::Char c_str(void) const;

View File

@ -555,12 +555,14 @@ void etk::FSNode::PrivateSetName(const etk::UString& newName)
}
}
#else
isRootFolder = destFilename.StartWith('/');
isRootFolder = destFilename.StartWith("/");
#endif
if (true == destFilename.StartWith(baseFolderHome) ) {
TK_DBG_MODE(" ==> detect home");
destFilename.Remove(0, baseFolderHome.Size());
m_type = etk::FSN_TYPE_HOME;
} else if(true == isRootFolder) {
TK_DBG_MODE(" ==> detect root");
#ifdef __TARGET_OS__Windows
destFilename.Remove(0, 3);
#else
@ -569,6 +571,7 @@ void etk::FSNode::PrivateSetName(const etk::UString& newName)
m_type = etk::FSN_TYPE_DIRECT;
} else if( true == destFilename.StartWith("ROOT:")
|| true == destFilename.StartWith("root:") ) {
TK_DBG_MODE(" ==> detect root 2 ");
destFilename.Remove(0, 5);
m_type = etk::FSN_TYPE_DIRECT;
if(true == destFilename.StartWith("~")) {
@ -577,6 +580,7 @@ void etk::FSNode::PrivateSetName(const etk::UString& newName)
}
} else if( true == destFilename.StartWith("DIRECT:")
|| true == destFilename.StartWith("direct:") ) {
TK_DBG_MODE(" ==> detect direct");
destFilename.Remove(0, 7);
m_type = etk::FSN_TYPE_DIRECT;
if(true == destFilename.StartWith("~")) {
@ -585,25 +589,31 @@ void etk::FSNode::PrivateSetName(const etk::UString& newName)
}
} else if( true == destFilename.StartWith("DATA:")
|| true == destFilename.StartWith("data:") ) {
TK_DBG_MODE(" ==> detect data");
destFilename.Remove(0, 5);
m_type = etk::FSN_TYPE_DATA;
} else if( true == destFilename.StartWith("USERDATA:")
|| true == destFilename.StartWith("userdata:") ) {
TK_DBG_MODE(" ==> detect User-data");
destFilename.Remove(0, 9);
m_type = etk::FSN_TYPE_USER_DATA;
} else if( true == destFilename.StartWith("CACHE:")
|| true == destFilename.StartWith("cache:") ) {
TK_DBG_MODE(" ==> detect Cach");
destFilename.Remove(0, 6);
m_type = etk::FSN_TYPE_CACHE;
} else if( true == destFilename.StartWith("THEME:")
|| true == destFilename.StartWith("theme:") ) {
TK_DBG_MODE(" ==> detect theme");
destFilename.Remove(0, 6);
m_type = etk::FSN_TYPE_THEME;
} else if(true == destFilename.StartWith("~")) {
TK_DBG_MODE(" ==> detect home 2");
destFilename.Remove(0, 1);
m_type = etk::FSN_TYPE_HOME;
} else if( true == destFilename.StartWith("HOME:")
|| true == destFilename.StartWith("home:") ) {
TK_DBG_MODE(" ==> detect home 3");
destFilename.Remove(0, 5);
m_type = etk::FSN_TYPE_HOME;
if(true == destFilename.StartWith("~")) {
@ -613,6 +623,7 @@ void etk::FSNode::PrivateSetName(const etk::UString& newName)
destFilename.Remove(0, baseRunPath.Size());
m_type = etk::FSN_TYPE_RELATIF;
} */else {
TK_DBG_MODE(" ==> detect other");
// nothing to remove
//Other type is Relative :
m_type = etk::FSN_TYPE_RELATIF;