added: to the Item: auth_path - a path to a static file (if auth is different from auth_none)

added: function 'mv' (move)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@596 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-03-15 01:47:26 +00:00
parent ebd868fa33
commit 6fbcffe63b
33 changed files with 1122 additions and 319 deletions

View File

@@ -608,6 +608,54 @@ bool CreateDir(const std::string & dir, int priv)
// creating directories (can be more than one)
// 'dirs' can begin with a slash (will be skipped)
bool CreateDirs(const char * base_dir, const char * dirs, int priv)
{
static std::string temp;
const char * p = dirs;
temp = base_dir; // we start creating from 'base_dir'
if( temp.empty() )
return false;
if( temp[temp.size()-1] != '/' )
temp += '/';
while( true )
{
// skipping slashes
for( ; *p=='/' ; ++p );
if( *p == 0 )
break;
// taking the name
for( ; *p && *p!='/' ; ++p )
temp += *p;
if( !CreateDir(temp.c_str(), priv) )
return false;
temp += '/';
}
return true;
}
bool CreateDirs(const std::string & base_dir, const std::string & dirs, int priv)
{
return CreateDirs(base_dir.c_str(), dirs.c_str(), priv);
}
// if there is not an extension it returns a pointer to the last '\0' character
const char * GetFileExt(const char * name)
{
@@ -642,7 +690,12 @@ Item::Auth SelectFileType(const char * file_name)
// as an image we're using only those types which can be rendered
// by a web browser
if( EqualNoCase(ext, "jpg") ||
EqualNoCase(ext, "jpeg") ||
EqualNoCase(ext, "jpe") ||
EqualNoCase(ext, "pic") ||
EqualNoCase(ext, "tga") ||
EqualNoCase(ext, "gif") ||
EqualNoCase(ext, "bmp") ||
EqualNoCase(ext, "png") )
return Item::auth_image;