本文整理汇总了C++中FSList::First方法的典型用法代码示例。如果您正苦于以下问题:C++ FSList::First方法的具体用法?C++ FSList::First怎么用?C++ FSList::First使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSList
的用法示例。
在下文中一共展示了FSList::First方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteList
bool OperCFThread::DeleteList( FS* fs, FSPath& _path, FSList& list )
{
if ( Info()->Stopped() ) { return false; }
FSPath path = _path;
int cnt = path.Count();
for ( FSNode* node = list.First(); node; node = node->next )
{
if ( node->extType ) { continue; }
path.SetItemStr( cnt, node->Name() );
if ( node->IsDir() && !node->st.IsLnk() )
{
if ( !DeleteDir( fs, path ) ) { return false; }
if ( !RmDir( fs, path ) ) { return false; }
continue;
}
if ( !DeleteFile( fs, path ) ) { return false; }
}
return true;
}
示例2: DeleteListRecursively
bool DeleteListRecursively( FS* fs, FSPath path, FSList& list )
{
const int cnt = path.Count();
int ret_err;
for ( FSNode* node = list.First(); node; node = node->next )
{
if ( node->extType )
{
continue;
}
path.SetItemStr( cnt, node->Name() );
if ( node->IsDir() && !node->st.IsLnk() )
{
if ( !DeleteDirRecursively( fs, path ) )
{
return false;
}
}
else if ( fs->Delete( path, &ret_err, nullptr ) != 0 )
{
return false;
}
}
return true;
}
示例3: CopyDir
bool OperCFThread::CopyDir(FS *srcFs, FSPath &__srcPath, FSNode *srcNode, FS *destFs, FSPath &__destPath, bool move)
{
if (Info()->Stopped()) return false;
FSList list;
int ret_error;
while (true) {
int ret = srcFs->ReadDir(&list, __srcPath, &ret_error, Info());
if (ret == -2) return false;
if (!ret) break;
switch ( RedMessage( _LT("Can`t open directory:\n") , srcFs->Uri(__srcPath).GetUtf8(), bRetrySkipCancel, srcFs->StrError(ret_error).GetUtf8()) ) {
case CMD_SKIP: return true;
case CMD_RETRY: continue;
default: return false;
}
}
while (destFs->MkDir(__destPath, MkDirMode, &ret_error, Info()) && !destFs->IsEEXIST(ret_error)) {
switch (RedMessage( _LT("Can't create the directory:\n"), destFs->Uri(__destPath).GetUtf8(), bRetrySkipCancel, destFs->StrError(ret_error).GetUtf8())) {
case CMD_CANCEL: return false;
case CMD_SKIP: return true;
}
}
FSPath srcPath = __srcPath; int srcPos = srcPath.Count();
FSPath destPath = __destPath; int destPos = destPath.Count();
for (FSNode *node = list.First(); node; node = node->next)
{
if (Info()->Stopped()) return false;
srcPath.SetItemStr(srcPos, node->Name());
destPath.SetItemStr(destPos, node->Name());
if (!CopyNode(srcFs, srcPath, node, destFs, destPath, move)) return false;
}
destFs->SetFileTime(destPath, srcNode->st.mtime, srcNode->st.mtime, 0, Info());
return !move || RmDir(srcFs, __srcPath);
}
示例4: MoveDir
int OperCFThread::MoveDir( FS* srcFs, FSPath& __srcPath, FSNode* srcNode, FS* destFs, FSPath& __destPath )
{
if ( Info()->Stopped() ) { return -1; }
if ( srcFs != destFs ) { return 1; }
FSPath srcPath = __srcPath;
int srcPos = srcPath.Count();
FSPath destPath = __destPath;
int destPos = destPath.Count();
if ( IsSameFile( srcFs, srcPath, &( srcNode->st ), destFs, destPath ) )
{
RedMessage( _LT( "Can't move directory to itself:\n" ), srcFs->Uri( __srcPath ).GetUtf8() );
return -1;
}
FSStat st;
int ret_error;
if ( !destFs->Stat( destPath, &st, &ret_error, Info() ) )
{
if ( !st.IsDir() )
{
switch ( RedMessage( _LT( "Can't copy directory\n" ), srcFs->Uri( srcPath ).GetUtf8(), _LT( "to file" ), "\n", _LT( "Delete the file?" ), destFs->Uri( destPath ).GetUtf8(), bOkSkipCancel ) )
{
case CMD_CANCEL:
return -1;
case CMD_SKIP:
return 0;
}
if ( !Unlink( destFs, destPath ) ) { return -1; }
}
else
{
FSList list;
while ( true )
{
int ret = srcFs->ReadDir( &list, srcPath, &ret_error, Info() );
if ( ret == -2 ) { return -1; }
if ( !ret ) { break; }
switch ( RedMessage( _LT( "Can`t open directory:\n" ), srcFs->Uri( __srcPath ).GetUtf8(), bRetrySkipCancel, srcFs->StrError( ret_error ).GetUtf8() ) )
{
case CMD_SKIP:
return 0;
case CMD_RETRY:
continue;
default:
return -1;
}
}
for ( FSNode* node = list.First(); node; node = node->next )
{
if ( Info()->Stopped() ) { return -1; }
srcPath.SetItemStr( srcPos, node->Name() );
destPath.SetItemStr( destPos, node->Name() );
if ( !MoveFile( srcFs, srcPath, node, destFs, destPath ) ) { return -1; }
}
destFs->SetFileTime( destPath, srcNode->st.m_CreationTime, srcNode->st.m_LastWriteTime, srcNode->st.m_LastWriteTime, 0, Info() );
return RmDir( srcFs, srcPath ) ? 0 : -1;
}
}
if ( srcFs->Rename( srcPath, destPath, &ret_error, Info() ) )
{
if ( srcFs->IsEXDEV( ret_error ) ) { return 1; }
return RedMessage( _LT( "Can't rename the directory:\n" ), srcFs->Uri( srcPath ).GetUtf8(), "\nto\n", destFs->Uri( destPath ).GetUtf8(),
bSkipCancel, srcFs->StrError( ret_error ).GetUtf8() ) == CMD_SKIP ? 0 : -1;
}
return 0;
}