update For_each_file() to pass both full path and file name only to the callback

All  callbacks need to extract the filename anyway, so it simplify the code
This commit is contained in:
Thomas Bernard
2018-02-13 10:30:10 +01:00
parent a4593da4d4
commit 4a2754321f
5 changed files with 13 additions and 27 deletions

View File

@@ -358,7 +358,7 @@ int File_length_file(FILE * file)
return infos_fichier.st_size;
}
void For_each_file(const char * directory_name, void Callback(const char *))
void For_each_file(const char * directory_name, void Callback(const char *, const char *))
{
// Pour scan de répertoire
DIR* current_directory; //Répertoire courant
@@ -385,7 +385,7 @@ void For_each_file(const char * directory_name, void Callback(const char *))
stat(full_filename,&Infos_enreg);
if (S_ISREG(Infos_enreg.st_mode))
{
Callback(full_filename);
Callback(full_filename, entry->d_name);
}
}
closedir(current_directory);