salut a toutes (?) et tous, j'ai ecrit une tite fonction de listage de fichier recursive que voici :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
bool CPictureManager::picFinder(TCHAR * path)
{
 
	TCHAR tempPath [MAX_PATH];
	TCHAR tmp [MAX_PATH];
 
	lstrcpy(tempPath,path);
	lstrcpy(tmp,path);
 
	lstrcat(tempPath,this->m_searchedFiles);
 
	#ifdef DEBUG
	UNICODE_debugTrace(TEXT("CPictureManager::picFinder => Start searching in %s"),tempPath);
	#endif
 
	WIN32_FIND_DATA FileData = {0}; 
	HANDLE hFile = NULL; 
 
	hFile = FindFirstFile(tempPath, &FileData);
 
 
	if (hFile != INVALID_HANDLE_VALUE) 
	{
		do
		{
			if((FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !(FileData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
			{
				#ifdef DEBUG
				UNICODE_debugTrace(TEXT("CPictureManager::picFinder => folder found : %s"),FileData.cFileName);
				#endif
				this->picFinder(lstrcat(tmp,lstrcat(FileData.cFileName,TEXT("\\"))));
			}
 
			else if(!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !(FileData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
			{
				#ifdef DEBUG
				UNICODE_debugTrace(TEXT("CPictureManager::picFinder => file found : %s"),FileData.cFileName);
				#endif
			}
		}while (FindNextFile(hFile, &FileData) != 0);
	}
 
	#ifdef DEBUG
	UNICODE_debugTrace(TEXT("CPictureManager::picFinder => End of search in %s"),tempPath);
	#endif
 
	return true;
}
et la trace donne ça
12:49:53(9274390680),thr 0x02D334DA : CPictureManager::picFinder => Start searching in \*.*

12:49:53(9274395945),thr 0x02D334DA : CPictureManager::picFinder => file found : ftlcpc007.jpg

12:49:53(9274400150),thr 0x02D334DA : CPictureManager::picFinder => folder found : profiles

12:49:53(9274403812),thr 0x02D334DA : CPictureManager::picFinder => Start searching in \profiles\*.*

12:49:53(9274408783),thr 0x02D334DA : CPictureManager::picFinder => folder found : default

12:49:53(9274411938),thr 0x02D334DA : CPictureManager::picFinder => Start searching in \profiles\default\*.*

12:49:53(9274418123),thr 0x02D334DA : CPictureManager::picFinder => file found : ftlcpc007.jpg

12:49:53(9274423101),thr 0x02D334DA : CPictureManager::picFinder => End of search in \profiles\default\*.*

12:49:53(9274427250),thr 0x02D334DA : CPictureManager::picFinder => End of search in \profiles\*.*

12:49:53(9274431179),thr 0x02D334DA : CPictureManager::picFinder => folder found : Storage

12:49:53(9274435165),thr 0x02D334DA : CPictureManager::picFinder => Start searching in \profiles\Storage\*.*

12:49:53(9274439387),thr 0x02D334DA : CPictureManager::picFinder => End of search in \profiles\Storage\*.*

12:49:53(9274444863),thr 0x02D334DA : CPictureManager::picFinder => folder found : Temp

12:49:53(9274448513),thr 0x02D334DA : CPictureManager::picFinder => Start searching in \profiles\Storage\Temp\*.*

12:49:53(9274452770),thr 0x02D334DA : CPictureManager::picFinder => End of search in \profiles\Storage\Temp\*.*

12:49:53(9274457384),thr 0x02D334DA : CPictureManager::picFinder => folder found : Windows

12:49:53(9274461448),thr 0x02D334DA : CPictureManager::picFinder => Start searching in \profiles\Storage\Temp\Windows\*.*

12:49:53(9274465693),thr 0x02D334DA : CPictureManager::picFinder => End of search in \profiles\Storage\Temp\Windows\*.*

12:49:53(9274470171),thr 0x02D334DA : CPictureManager::picFinder => End of search in \*.*
et je comprends pô pourquoi il colle les dossiers les un aux autres quand il sort des sous dossiers
End of search in \profiles\*.*
CPictureManager::picFinder => folder found : Storage
CPictureManager::picFinder => Start searching in \profiles\Storage\*.*
alors que l'arbo est :
\Profiles
\Storage
Quelqu'un voit une grosse bourde que j'ai pas vue depuis une heure que je #¨$+}°@