本文整理汇总了C++中CFileList::sort方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileList::sort方法的具体用法?C++ CFileList::sort怎么用?C++ CFileList::sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileList
的用法示例。
在下文中一共展示了CFileList::sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFileList
//.........这里部分代码省略.........
{
do
{
fullPath = Path + c_file.name;
r->addItem(fullPath, c_file.size, (_A_SUBDIR & c_file.attrib) != 0, 0);
}
while( _findnext( hFile, &c_file ) == 0 );
_findclose( hFile );
}
#endif
//TODO add drives
//entry.Name = "E:\\";
//entry.isDirectory = true;
//Files.push_back(entry);
#endif
// --------------------------------------------
//! Linux version
#if (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
r = new CFileList(Path, false, false);
r->addItem(Path + "..", 0, true, 0);
//! We use the POSIX compliant methods instead of scandir
DIR* dirHandle=opendir(Path.c_str());
if (dirHandle)
{
struct dirent *dirEntry;
while ((dirEntry=readdir(dirHandle)))
{
u32 size = 0;
bool isDirectory = false;
fullPath = Path + dirEntry->d_name;
if((strcmp(dirEntry->d_name, ".")==0) ||
(strcmp(dirEntry->d_name, "..")==0))
{
continue;
}
struct stat buf;
if (stat(dirEntry->d_name, &buf)==0)
{
size = buf.st_size;
isDirectory = S_ISDIR(buf.st_mode);
}
#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__)
// only available on some systems
else
{
isDirectory = dirEntry->d_type == DT_DIR;
}
#endif
r->addItem(fullPath, size, isDirectory, 0);
}
closedir(dirHandle);
}
#endif
}
else
{
//! create file list for the virtual filesystem
r = new CFileList(Path, false, false);
//! add relative navigation
SFileListEntry e2;
SFileListEntry e3;
//! PWD
r->addItem(Path + ".", 0, true, 0);
//! parent
r->addItem(Path + "..", 0, true, 0);
//! merge archives
for (u32 i=0; i < FileArchives.size(); ++i)
{
const IFileList *merge = FileArchives[i]->getFileList();
for (u32 j=0; j < merge->getFileCount(); ++j)
{
if (core::isInSameDirectory(Path, merge->getFullFileName(j)) == 0)
{
io::path fullPath = merge->getFullFileName(j);
r->addItem(fullPath, merge->getFileSize(j), merge->isDirectory(j), 0);
}
}
}
}
if (r)
r->sort();
return r;
}