Esempio n. 1
0
// DirPath should by a directory with a trailing slash.
// Returns all files in the directory, already prepended by root.
// Subdirectories will have a trailing slash.
// All files and directories that start with . are skipped.
Array<String> DirectoryFileList( const char * DirPath )
{
	Array<String>	strings;

	DIR * dir = opendir( DirPath );
	if ( dir != NULL )
	{
		struct dirent * entry;
		while ( ( entry = readdir( dir ) ) != NULL )
		{
			if ( entry->d_name[ 0 ] == '.' )
			{
				continue;
			}
			if ( entry->d_type == DT_DIR )
			{
				String s( DirPath );
				s += entry->d_name;
				s += "/";
				strings.PushBack( s );
			}
			else if ( entry->d_type == DT_REG )
			{
				String s( DirPath );
				s += entry->d_name;
				strings.PushBack( s );
			}
		}
		closedir( dir );
	}

	SortStringArray( strings );

	return strings;
}
Esempio n. 2
0
void CFunctionPage::LoadGeneralResources()
{
	m_GeneralResources.RemoveAll();
	m_pResManager->GetMenuIds(m_GeneralResources);
	m_pResManager->GetAcceleratorIds(m_GeneralResources);
	m_pResManager->GetToolbarIds(m_GeneralResources);
	
	//сортировка
	SortStringArray(m_GeneralResources);
	//удаление повторяющихся идентификаторов
	CString PrevWord;
	for (int i = (int)m_GeneralResources.GetCount() - 1; i >= 0; i--)
	{
		if (m_GeneralResources[i] == PrevWord)
		{
			m_GeneralResources.RemoveAt(i);
		}
		else
		{
			PrevWord = m_GeneralResources[i];
		}
	}
}