Updated win32 solution and also made mgm files optional (not required) so that mega-glest will work with or without the new 8 player maps

This commit is contained in:
Mark Vejvoda
2010-03-09 00:43:46 +00:00
parent 3041efaa77
commit 4ecc284f75
11 changed files with 924 additions and 915 deletions

View File

@@ -119,7 +119,7 @@ int64 Chrono::queryCounter(int multiplier) const {
// =====================================
//finds all filenames like path and stores them in resultys
void findAll(const string &path, vector<string> &results, bool cutExtension) {
void findAll(const string &path, vector<string> &results, bool cutExtension, bool errorOnNotFound) {
results.clear();
std::string mypath = path;
@@ -131,6 +131,8 @@ void findAll(const string &path, vector<string> &results, bool cutExtension) {
mypath += "*";
}
if(Socket::enableDebugText) printf("In [%s::%s] scanning [%s]\n",__FILE__,__FUNCTION__,mypath.c_str());
glob_t globbuf;
int res = glob(mypath.c_str(), 0, 0, &globbuf);
@@ -153,7 +155,7 @@ void findAll(const string &path, vector<string> &results, bool cutExtension) {
globfree(&globbuf);
if(results.size() == 0) {
if(results.size() == 0 && errorOnNotFound == true) {
throw runtime_error("No files found in: " + mypath);
}

View File

@@ -163,7 +163,7 @@ void PlatformExceptionHandler::install(string dumpFileName){
// =====================================================
//finds all filenames like path and stores them in resultys
void findAll(const string &path, vector<string> &results, bool cutExtension){
void findAll(const string &path, vector<string> &results, bool cutExtension, bool errorOnNotFound){
int i= 0;
struct _finddata_t fi;
@@ -184,11 +184,11 @@ void findAll(const string &path, vector<string> &results, bool cutExtension){
}
while(_findnext(handle, &fi)==0);
}
else{
else if(errorOnNotFound == true){
throw runtime_error("Error opening files: "+ path);
}
if(i==0){
if(i==0 && errorOnNotFound == true){
throw runtime_error("No files found: "+ path);
}