added: function: default

changes the default item in a directory


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@473 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2008-12-31 18:28:12 +00:00
parent f6ad846927
commit 8a0ea59c77
16 changed files with 339 additions and 11 deletions

View File

@@ -343,3 +343,32 @@ void Dirs::AddDir(const Item & item)
dir_table.PushBack(item);
}
void Dirs::SplitPath(const std::string & path, std::string & dir, std::string & file)
{
std::string::size_type i;
dir.clear();
file.clear();
if( path.empty() )
// !! moze dir ustawic na '/' ?
return;
for( i=path.size()-1 ; i>0 && path[i]!='/' ; --i);
if( path[i] != '/' )
{
// we do not have any slashes '/'
file = path;
return;
}
dir.assign(path, 0, i + 1); // +1 means with a slash at the end
if( i < path.size() - 1 )
file.assign(path, i+1, path.size() - i - 1);
}