本文整理汇总了C++中GetFileList函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFileList函数的具体用法?C++ GetFileList怎么用?C++ GetFileList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetFileList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateGroupItems
static void UpdateGroupItems(std::vector<CProject::Group>& m_Groups)
{
std::vector<std::string> folderlist = GetFolderList("*");
for (unsigned int i = 0; i < folderlist.size(); i++) {
if (!strcmp(folderlist[i].c_str(), ".")
|| !strcmp(folderlist[i].c_str(), "..")) {
continue;
}
// insert files into that folder
char directory[MAX_PATH] = {0};
GetCurrentDirectory(MAX_PATH, directory);
SetCurrentDirectory(folderlist[i].c_str());
std::vector<std::string> filelist = GetFileList("*");
if (1) {
CProject::Group current;
current.FolderName = folderlist[i];
current.Files = GetFileList("*");
m_Groups.push_back(current);
}
filelist.clear();
if (GetFolderList("*").size() > 0) {
UpdateGroupItems(m_Groups);
}
SetCurrentDirectory(directory);
}
}
示例2: GetFileList
void GUIFileSelector::SetPageFocus(int inFocus)
{
if (inFocus)
{
std::string value;
DataManager::GetValue(mPathVar, value);
if (GetFileList(value) != 0 && (mShowNavFolders != 0 || mShowFiles != 0)) {
GetFileList(DataManager::GetCurrentStoragePath());
DataManager::SetValue(mPathVar, DataManager::GetCurrentStoragePath());
}
}
}
示例3: ensure_path_mounted
void GUIFileSelector::SetPageFocus(int inFocus)
{
if (inFocus)
{
std::string value;
DataManager::GetValue(mPathVar, value);
// This is because some installers will unmount the sdcard
ensure_path_mounted("/sdcard");
if (GetFileList(value) != 0 && (mShowNavFolders != 0 || mShowFiles != 0))
GetFileList("/sdcard");
}
}
示例4: GetFileListRecursive
void GetFileListRecursive(std::string dir, StringList& files, bool withQueriedDir /* = false */)
{
std::stack<std::string> stk;
if(withQueriedDir)
{
stk.push(dir);
while(stk.size())
{
dir = stk.top();
stk.pop();
MakeSlashTerminated(dir);
StringList li;
GetFileList(dir.c_str(), li);
for(std::deque<std::string>::iterator it = li.begin(); it != li.end(); ++it)
files.push_back(dir + *it);
li.clear();
GetDirList(dir.c_str(), li, true);
for(std::deque<std::string>::iterator it = li.begin(); it != li.end(); ++it)
stk.push(dir + *it);
}
}
else
{
std::string topdir = dir;
MakeSlashTerminated(topdir);
stk.push("");
while(stk.size())
{
dir = stk.top();
stk.pop();
MakeSlashTerminated(dir);
StringList li;
dir = topdir + dir;
GetFileList(dir.c_str(), li);
for(std::deque<std::string>::iterator it = li.begin(); it != li.end(); ++it)
files.push_back(dir + *it);
li.clear();
GetDirList(dir.c_str(), li, true);
for(std::deque<std::string>::iterator it = li.begin(); it != li.end(); ++it)
stk.push(dir + *it);
}
}
}
示例5: locker
bool wxGISDataset::Delete(int iLayer, ITrackCancel* const pTrackCancel)
{
wxCriticalSectionLocker locker(m_CritSect);
Close();
if(!DeleteFile(m_sPath))
return false;
char** papszFileList = GetFileList();
if(papszFileList)
{
IProgressor* pProgressor(NULL);
if(pTrackCancel)
{
pProgressor = pTrackCancel->GetProgressor();
if(pProgressor)
pProgressor->SetRange(CSLCount(papszFileList));
}
for(int i = 0; papszFileList[i] != NULL; ++i )
{
DeleteFile(papszFileList[i]);
if(pProgressor)
pProgressor->SetValue(i);
}
CSLDestroy( papszFileList );
}
return true;
}
示例6: delete_fn
void delete_fn(file_info *finfo, const char *name, void *state)
{
int rc;
char temp[512];
char s[1024];
char FileName[128];
DWORD gle;
sprintf(FileName, "Thread_%05d.log", ProcessNumber);
if (finfo->mode & aDIR)
{
char s2[1024];
sprintf(s2, "%s\\*", name);
GetFileList(s2, delete_fn, NULL);
sprintf(s, "%s", &name[strlen(AfsLocker)]);
nb_rmdir(s);
}
else
{
rc = DeleteFile(name);
gle = GetLastError();
if (!rc)
{
LeaveThread(0, "", CMD_UNLINK);
sprintf(temp, "FILE: DeleteFile %s failed GLE(0x%x)\n", name, gle);
if (verbose)
printf("%s", temp);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return;
}
}
return;
}
示例7: nb_findfirst
int nb_findfirst(char *mask)
{
int rc;
char FileName[128];
char NewMask[512];
char temp[512];
if (strstr(mask, "<.JNK"))
return(0);
sprintf(FileName, "Thread_%05d.log", ProcessNumber);
strcpy(NewMask, AfsLocker);
strcat(NewMask, mask);
StartFirstTimer();
rc = GetFileList(NewMask, (void *)find_fn, NULL);
if (!rc)
{
EndFirstTimer(CMD_FIND_FIRST, 0);
sprintf(temp, "File: findfirst cannot find for %s\n", mask);
if (verbose)
printf("%s", temp);
LeaveThread(1, temp, CMD_FIND_FIRST);
LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
return(-1);
}
EndFirstTimer(CMD_FIND_FIRST, 1);
return(0);
}
示例8: GetFileList
bool MemoryCardDriverThreaded_Linux::USBStorageDevicesChanged()
{
RString sThisDevices;
/* If a device is removed and reinserted, the inode of the /sys/block entry
* will change. */
RString sDevicePath = "/sys/block/";
vector<RString> asDevices;
GetFileList( sDevicePath, asDevices );
for( unsigned i = 0; i < asDevices.size(); ++i )
{
struct stat buf;
if( stat( sDevicePath + asDevices[i], &buf ) == -1 )
continue; // XXX warn
sThisDevices += ssprintf( "%i,", (int) buf.st_ino );
}
bool bChanged = sThisDevices != m_sLastDevices;
m_sLastDevices = sThisDevices;
if( bChanged )
LOG->Trace( "Change in USB storage devices detected." );
return bChanged;
}
示例9: GetFileList
size_t GetFileList( const char *_path, std::vector<std::string> &list, bool recur )
{
size_t s = list.size();
char path[MAX_PATH], n[128];
strcpy( path, _path );
int pos = SplitFileName( path );
path[pos] = '\0';
strcpy( n, &path[pos+1] );
WIN32_FIND_DATA fdata;
HANDLE h = FindFirstFile( _path, &fdata );
if( h == INVALID_HANDLE_VALUE ) return list.size() - s;
do
{
char p[MAX_PATH];
sprintf( p, "%s\\%s", path, fdata.cFileName );
list.push_back( p );
if( recur &&
fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
strcmp( "..", fdata.cFileName ) &&
strcmp( ".", fdata.cFileName ) )
{
char p[MAX_PATH];
sprintf( p, "%s\\%s\\%s", path, fdata.cFileName, n );
GetFileList( p, list, recur );
}
} while( FindNextFile( h, &fdata ) );
FindClose( h );
return list.size() - s;
}
示例10: GetGameState
GUnitViewer* GUnitViewer::CreateUnitViewer(GnList<GUserHaveItem::Item>& cUnitItems)
{
GetGameState()->SetGameScale( 0.7f );
GUnitViewer* thisObject = GnNew GUnitViewer();
GnListIterator<GUserHaveItem::Item> iter = cUnitItems.GetIterator();
gtint itemCount = 0;
while( iter.Valid() )
{
guint32 unitIndex = iter.Item().mIndex;
gchar idName[16] = { 0, };
GetFileList()->GetForcesFileName( (gtuint)unitIndex, idName, sizeof( idName ) );
GForcesController* controller = GForcesController::Create( idName, 1 );
if( controller )
{
GnVector2 pos( 340.0f, 150.0f );
if( itemCount == 0 )
pos.x -= 10.0f;
controller->SetPosition( pos );
controller->GetMesh()->SetVisible( false );
thisObject->AddMeshToParentNode( controller->GetMesh() );
controller->GetActor()->SetTargetAnimation( GAction::ANI_ATTACK );
thisObject->AddActorCtlr( unitIndex, controller );
}
iter.Forth();
++itemCount;
}
GetGameState()->SetGameScale( 1.0f );
return thisObject;
}
示例11: if
void
JVMGetSourceFileList::ScanDirectory
(
const JCharacter* path
)
{
JDirInfo* info;
if (!JDirInfo::Create(path, &info))
{
return;
}
JXFileListTable* table = (GetFileList())->GetTable();
const JSize count = info->GetEntryCount();
for (JIndex i=1; i<=count; i++)
{
const JDirEntry& e = info->GetEntry(i);
if (e.GetType() == JDirEntry::kFile)
{
const CBTextFileType fileType =
(CMGetPrefsManager())->GetFileType(e.GetName());
if (fileType == kCBJavaSourceFT)
{
table->AddFile(e.GetFullName());
}
}
else if (e.GetType() == JDirEntry::kDir)
{
ScanDirectory(e.GetFullName());
}
}
delete info;
}
示例12: gui_parse_text
int GUIFileSelector::NotifyVarChange(std::string varName, std::string value)
{
if (varName.empty())
{
// Always clear the data variable so we know to use it
DataManager::SetValue(mVariable, "");
}
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {
mLastValue = newValue;
mStart = 0;
scrollingY = 0;
scrollingSpeed = 0;
mUpdate = 1;
}
}
if (varName == mPathVar || varName == mSortVariable)
{
DataManager::GetValue(mPathVar, value); // sometimes the value will be the sort order instead of the path, so we read the path everytime
DataManager::GetValue(mSortVariable, mSortOrder);
mStart = 0;
scrollingY = 0;
scrollingSpeed = 0;
GetFileList(value);
mUpdate = 1;
return 0;
}
return 0;
}
示例13: wcscpy
bool CSVFile::GetPathFromSettings(const TCHAR *lr2Path, TCHAR *out) {
// first of all, get setting and replace path
std::wstring keyval;
bool foundSetting = false;
if (CSVSettings::GetPathValue(lr2Path, keyval)) {
std::wstring wpath = lr2Path;
int p = wpath.find(L'*');
if (p != std::wstring::npos) {
wpath.replace(p, 1, keyval);
if (boost::filesystem::exists(wpath)) {
wcscpy(out, wpath.c_str());
foundSetting = true;
}
}
}
if (foundSetting)
return true;
// when no setting found, then get default value
std::vector<std::wstring> files;
GetFileList(lr2Path, files);
if (files.size() == 0) {
return false;
} else if (files.size() == 1) {
wcscpy(out, files[0].c_str());
return true;
} else {
// index 0 is default
wcscpy(out, files[0].c_str());
return true;
}
}
示例14: strcpy
//-----------------------------------------------------------------------------
// Purpose: Generate a list of file matching mask
//-----------------------------------------------------------------------------
int CScriptLib::FindFiles( char* pFileMask, bool bRecurse, CUtlVector<fileList_t> &fileList )
{
char dirPath[MAX_PATH];
char pattern[MAX_PATH];
char extension[MAX_PATH];
// get path only
strcpy( dirPath, pFileMask );
V_StripFilename( dirPath );
// get pattern only
V_FileBase( pFileMask, pattern, sizeof( pattern ) );
V_ExtractFileExtension( pFileMask, extension, sizeof( extension ) );
if ( extension[0] )
{
strcat( pattern, "." );
strcat( pattern, extension );
}
if ( !bRecurse )
{
GetFileList( dirPath, pattern, fileList );
}
else
{
// recurse and get the tree
CUtlVector< fileList_t > tempList;
CUtlVector< CUtlString > dirList;
RecurseFileTree_r( dirPath, 0, dirList );
for ( int i=0; i<dirList.Count(); i++ )
{
// iterate each directory found
tempList.Purge();
tempList.EnsureCapacity( dirList.Count() );
GetFileList( dirList[i].String(), pattern, tempList );
int start = fileList.AddMultipleToTail( tempList.Count() );
for ( int j=0; j<tempList.Count(); j++ )
{
fileList[start+j] = tempList[j];
}
}
}
return fileList.Count();
}
示例15: main
int main( int argc, char ** argv )
{
int nLibIndex = ParseArgs( argc, argv );
if( nLibIndex == 0 )
return -1;
if( g_fDiag )
Diags( argc, argv );
Logger logger;
GetLinuxPwd();
for( ; nLibIndex < argc; nLibIndex++ )
{
StringList files = GetFileList( argv[nLibIndex] );
for( StringList::const_iterator it=files.begin(); it!=files.end(); ++it )
{
std::string library = *it;
std::cout << "Loading Library: " << library << std::endl;
DllHandle hModule = LOAD_LIBRARY( library.c_str() );
DLERROR_CHECK;
if( !hModule )
{
std::cout<<"ERROR: Failed to load "<< *it << std::endl;
std::cout.flush();
continue;
}
RunAllFn pRunAll = (RunAllFn)GET_PROC_ADDRESS( hModule, "RunAll" );
if( pRunAll == NULL )
{
std::cerr << std::endl << "Function RunAll() not found in library " << library << "!" << std::endl;
FREE_LIBRARY( hModule );
continue;
}
pRunAll( &logger, g_configFileName.c_str() );
FREE_LIBRARY( hModule );
} // next library
} // next arg
if( g_fCSV )
{
try
{
std::ofstream log(g_logPath.c_str());
GenerateReportCSV( logger, log, g_fNoHeader );
}
catch(...)
{
std::cerr << "Error writing log file " << g_logPath << "!" << std::endl;
}
}
std::cout << std::endl;
}