ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/Installer/trunk/source/subs.cpp
(Generate patch)

Comparing AE/Installer/trunk/source/subs.cpp (file contents):
Revision 298 by gumby, Tue Apr 28 14:45:43 2009 UTC vs.
Revision 306 by gumby, Sat May 2 16:34:23 2009 UTC

# Line 81 | Line 81 | vector<ModPackage> getPackages(void) {
81   #endif
82  
83          string filename = "\0";
84 <        string MODINFO_CFG = "\\Mod_Info.cfg";
84 >        string MODINFO_CFG = "Mod_Info.cfg";
85  
86 +        try
87 +        {
88  
89  
90 <        DIR *pdir;
91 <        struct dirent *pent;
92 <
93 <        pdir = opendir( path.c_str() ); //"." refers to the current dir
94 <        if (!pdir){
93 <                printf ("\nopendir() failure; terminating");
94 <                exit(1);
95 <        }
96 <        errno=0;
97 <
98 <        while (( pent = readdir(pdir) )){
90 >        directory_iterator end_iter;
91 >        for ( directory_iterator dir_itr( "./packages" );
92 >                dir_itr != end_iter;
93 >                ++dir_itr )
94 >        {
95  
96 <                filename = path + '\\' + pent->d_name + MODINFO_CFG;
97 <                file.open(filename.c_str());
96 >                
97 >                file.open( (dir_itr->path().string() + "/" + MODINFO_CFG ).c_str());
98  
99                  //cout << filename << "\n";
100  
101                  if(!file.fail() )
102                  {
103 <                        //file.open(filename.c_str(), fstream::out);
108 <
109 <                        //do stuff like adding to vector :P
110 <
103 >                        cout << dir_itr->path().string() + MODINFO_CFG ;
104                          //would prefer to push a pointer to a package, but this will do for now
105                          packages.push_back( fileToModPackage(file) );
106  
# Line 115 | Line 108 | vector<ModPackage> getPackages(void) {
108                  file.close();
109                  file.clear();
110  
118        }
111  
112  
121        if (errno){
122                printf ("readdir() failure; terminating");
123                exit(1);
113          }
125        closedir(pdir);
114  
115  
116 +        }
117 +        catch ( const std::exception & ex )
118 +        {
119 +                cout << "Warning, something odd happened!\n";
120 +        }
121 +
122          return packages;
123   }
124  
# Line 375 | Line 369 | void RecompileAll(vector<string> install
369                                  }
370                                  catch( const std::exception & ex ) {
371                                          cout << "Warning, exception " << ex.what() << "!\n"
372 <                                                << "You probably need to reGlobalize.;
372 >                                                << "You probably need to reGlobalize.";
373                                          create_directory( "./packages/VanillaDats" );
374                                  }
375  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)