Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 32534 Details for
Bug 52679
new ebuild: wormux
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
0.3-readdir.patch
0.3-readdir.patch (text/plain), 5.21 KB, created by
Michael Prager
on 2004-06-02 10:31:51 UTC
(
hide
)
Description:
0.3-readdir.patch
Filename:
MIME Type:
Creator:
Michael Prager
Created:
2004-06-02 10:31:51 UTC
Size:
5.21 KB
patch
obsolete
>--- wormux/wormux/src/avatar.cpp 2004/05/29 18:25:46 1.7 >+++ wormux/wormux/src/avatar.cpp 2004/06/02 15:45:05 1.8 >@@ -32,6 +32,7 @@ > #include "graphisme.h" > #include "gst_fichier.h" > #include <dirent.h> >+#include <sys/stat.h> > using namespace Wormux; > using namespace std; > >@@ -84,41 +85,6 @@ > > //----------------------------------------------------------------------------- > >-void InitAvatars() >-{ >- Avatar avatar; >- std::string repertoire = DATADIR+"avatar/"; >- std::string nom_avatar, nomfich, rep_avatar; >- struct dirent *fichier; >- DIR *dir; >- >- dir = opendir(repertoire.c_str()); >- if (dir == NULL) >- Erreur ("Impossible d'ouvrir le répertoire des avatars ("+repertoire+")"); >- >- // Parcours le répertoire des avatars >- while ((fichier = readdir(dir)) != NULL) >- { >- // On a trouvé un répertoire ? >- if ((fichier -> d_type == DT_DIR) && (fichier -> d_name[0] != '.')) >- { >- nom_avatar = fichier -> d_name; >- rep_avatar = repertoire+nom_avatar+'/'; >- >- // Si on arrive à le charger correctement, l'ajoute à la liste >- if (FichierExiste(rep_avatar+NOMFICH_CONFIG) >- && avatar.Charge (nom_avatar, rep_avatar)) >- { >- lst_avatar.insert (paire_avatar(nom_avatar, avatar)); >- } >- } >- } >- >- closedir (dir); >-} >- >-//----------------------------------------------------------------------------- >- > bool Avatar::Charge (const std::string &nom, const std::string &repertoire) > { > try >@@ -221,6 +187,44 @@ > Xml_LitArme (baseball, LitDocXml::AccesBalise (armes, "baseball")); > } > return true; >+} >+ >+//----------------------------------------------------------------------------- >+ >+void InitAvatars() >+{ >+ Avatar avatar; >+ std::string repertoire = DATADIR+"avatar/"; >+ struct dirent *fichier; >+ DIR *dir; >+ >+ dir = opendir(repertoire.c_str()); >+ if (dir == NULL) >+ Erreur ("Impossible d'ouvrir le répertoire des avatars ("+repertoire+")"); >+ >+ // Parcours le répertoire des avatars >+ while ((fichier = readdir(dir)) != NULL) >+ { >+ std::string nomfich_complet = repertoire+fichier -> d_name; >+ struct stat stat_file; >+ >+ // On a trouvé un répertoire ? >+ if ((fichier -> d_name[0] != '.') >+ && (stat(nomfich_complet.c_str(), &stat_file) == 0) >+ && (S_ISDIR(stat_file.st_mode))) >+ { >+ std::string rep_avatar = nomfich_complet+'/'; >+ >+ // Si on arrive à le charger correctement, l'ajoute à la liste >+ if (FichierExiste(rep_avatar+NOMFICH_CONFIG) >+ && avatar.Charge (fichier -> d_name, rep_avatar)) >+ { >+ lst_avatar.insert (paire_avatar(fichier -> d_name, avatar)); >+ } >+ } >+ } >+ >+ closedir (dir); > } > > //----------------------------------------------------------------------------- >--- wormux/wormux/src/gst_equipes.cpp 2004/06/01 17:07:35 1.2 >+++ wormux/wormux/src/gst_equipes.cpp 2004/06/02 15:45:05 1.3 >@@ -24,6 +24,7 @@ > #include "constante.h" > #include "gst_fichier.h" > #include <dirent.h> >+#include <sys/stat.h> > #include <algorithm> > //----------------------------------------------------------------------------- > GestionEquipes gst_equipes; >@@ -76,8 +77,7 @@ > > void GestionEquipes::ChargeListe() > { >- std::string repertoire = DATADIR+"equipe/"; >- std::string nom_equipe, nomfich, rep_equipe ; >+ const std::string repertoire = DATADIR+"equipe/"; > struct dirent *fichier; > DIR *dir; > >@@ -89,13 +89,24 @@ > liste.clear() ; > while ((fichier = readdir(dir)) != NULL) > { >+ std::string nomfich_complet = repertoire+fichier -> d_name; >+ struct stat stat_file; >+ > // On a trouvé un fichier normal ? >- if ((fichier -> d_type == DT_DIR) && (fichier -> d_name[0] != '.')) >+ if ((fichier -> d_name[0] != '.') >+ && (stat(nomfich_complet.c_str(), &stat_file) == 0) >+ && (S_ISDIR(stat_file.st_mode))) > { >+ // Ajoute l'équipe à la liste > Equipe nv_equipe; > liste_complete.push_back(nv_equipe); >- std::string nomfich = fichier -> d_name; >- if (!liste_complete.back().Init (-1, nomfich)) liste_complete.pop_back(); >+ >+ // Charge les données de l'équipe, >+ // en cas d'erreur retire l'équipe de la liste >+ if (!liste_complete.back().Init (-1, fichier -> d_name)) >+ { >+ liste_complete.pop_back(); >+ } > } > } > closedir (dir); >--- wormux/wormux/src/lst_terrain.cpp 2004/06/01 17:07:35 1.1 >+++ wormux/wormux/src/lst_terrain.cpp 2004/06/02 15:45:05 1.2 >@@ -25,6 +25,7 @@ > #include "monde.h" > #include "gst_fichier.h" > #include <dirent.h> >+#include <sys/stat.h> > //----------------------------------------------------------------------------- > ListeTerrain lst_terrain; > //----------------------------------------------------------------------------- >@@ -96,8 +97,12 @@ > struct dirent *fichier; > while ((fichier = readdir(dir)) != NULL) > { >- // On a trouvé un répertoire ? >- if ((fichier -> d_type == DT_DIR) && (fichier -> d_name[0] != '.')) >+ std::string nomfich_complet = repertoire+fichier -> d_name; >+ struct stat stat_file; >+ >+ if ((fichier -> d_name[0] != '.') >+ && (stat(nomfich_complet.c_str(), &stat_file) == 0) >+ && (S_ISDIR(stat_file.st_mode))) > { > InfoTerrain nv_terrain; > bool ok = nv_terrain.Init (fichier -> d_name);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 52679
:
32440
|
32442
|
32443
|
32444
|
32445
|
32446
|
32532
|
32533
|
32534
|
32537
|
34380
|
34381
|
34382
|
37489
|
43008
|
43009