Changeset 290 for AE/Installer
- Timestamp:
- Apr 4, 2009, 6:13:36 AM (16 years ago)
- Location:
- AE/Installer/trunk/source
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/Installer/trunk/source/methods.h
r286 r290 1 1 #include <string> 2 #include <vector> 3 4 5 using namespace std; 6 7 struct ModPackage { 8 bool isInstalled; //replace with function 9 string *name; 10 }; 11 2 12 int mainMenu(); 3 using namespace std; 13 vector<ModPackage> getPackages(); 14 ModPackage fileToModPackage(FILE&); 4 15 5 16 void installPackages(); … … 9 20 bool getDirectoryContents(char , char &); 10 21 11 struct ModPackage {12 bool isInstalled; //replace with function13 string *name;14 }; -
AE/Installer/trunk/source/subs.cpp
r288 r290 10 10 #include <vector> 11 11 12 #include <errno.h> 13 #include "Include\dirent.h" 14 #include <stdio.h> 15 #include <stdlib.h> 16 17 12 18 using namespace std; 13 19 bool FALSE = 0; … … 19 25 20 26 // SetConsoleTitle("AE Installer"); windows junk, convert to SDL 21 // system("color 0A"); 27 // system("color 0A"); 28 22 29 cout << "\nWelcome to the AE installer!\n"; 23 30 … … 25 32 26 33 return mainMenu(); 34 } 35 36 vector<ModPackage> getPackages(void) { 37 vector<ModPackage> packages; 38 packages.reserve(256); //thats 63 or 64 pointers to packages...i think. :P Reserving this improves performance when we add new pointers 39 40 #ifdef WIN32 41 string path = "K:\\Oni\\edition\\install\\packages"; //only for my build. :P 42 #else 43 string path = "K:\\Oni\\edition\\install\\packages"; //change this, 'scen. 44 #endif 45 46 string filename = "\0"; 47 string MODINFO_CFG = "\\Mod_Info.cfg"; 48 DIR *pdir; 49 struct dirent *pent; 50 51 pdir = opendir( path.c_str() ); //"." refers to the current dir 52 if (!pdir){ 53 printf ("opendir() failure; terminating"); 54 exit(1); 55 } 56 errno=0; 57 while ((pent=readdir(pdir))){ 58 59 60 filename = path + '\\' + pent->d_name + MODINFO_CFG; 61 62 //cout << filename << "\n"; 63 64 if (FILE * file = fopen( filename.c_str(), "r")) 65 { 66 //do stuff like adding to vector :P 67 68 cout << pent->d_name << "\n"; 69 70 //would prefer to push a pointer to a package, but this will do for now 71 //packages.push_back(modelfileToModPackage(file *)) 72 fclose(file); 73 } 74 75 } 27 76 28 77 78 if (errno){ 79 printf ("readdir() failure; terminating"); 80 exit(1); 81 } 82 closedir(pdir); 83 84 85 return packages; 29 86 } 30 87 … … 69 126 iter = packages.begin(); 70 127 128 getPackages(); 129 71 130 if (packages.empty()) { 72 131 cout << "Error: You have no packages!\n";
Note:
See TracChangeset
for help on using the changeset viewer.