mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 20:03:58 +02:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user