mirror of
https://github.com/glest/glest-source.git
synced 2025-09-29 08:59:01 +02:00
- added a new function to correct some file paths when loading a saved game from another persons computer (may need more tweaking)
- added support for saving and loading tables from Lua
This commit is contained in:
@@ -150,7 +150,7 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
|
||||
ifstream file(filepath.c_str(), ios::in | ios::binary);
|
||||
#endif
|
||||
if (!file.is_open()) { //An error occured; TODO: Which one - throw an exception, print error message?
|
||||
throw runtime_error("Could not open file " + filepath);
|
||||
throw runtime_error("[#1] Could not open file " + filepath);
|
||||
}
|
||||
for (typename vector<FileReader<T> const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) {
|
||||
T* ret = NULL;
|
||||
@@ -192,9 +192,9 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
|
||||
if (!file.is_open()) { //An error occured; TODO: Which one - throw an exception, print error message?
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
DWORD error = GetLastError();
|
||||
throw runtime_error("Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " [" + filepath + "]");
|
||||
throw runtime_error("[#2] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " [" + filepath + "]");
|
||||
#else
|
||||
throw runtime_error("Could not open file [" + filepath + "]");
|
||||
throw runtime_error("[#2] Could not open file [" + filepath + "]");
|
||||
#endif
|
||||
}
|
||||
for (typename vector<FileReader<T> const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) {
|
||||
@@ -329,7 +329,7 @@ T* FileReader<T>::read(const string& filepath) const {
|
||||
ifstream file(filepath.c_str(), ios::in | ios::binary);
|
||||
#endif
|
||||
if (!file.is_open()) { //An error occured; TODO: Which one - throw an exception, print error message?
|
||||
throw runtime_error("Could not open file " + filepath);
|
||||
throw runtime_error("[#3] Could not open file " + filepath);
|
||||
}
|
||||
T* ret = read(file,filepath);
|
||||
file.close();
|
||||
@@ -354,7 +354,7 @@ T* FileReader<T>::read(const string& filepath, T* object) const {
|
||||
ifstream file(filepath.c_str(), ios::in | ios::binary);
|
||||
#endif
|
||||
if (!file.is_open()) { //An error occured; TODO: Which one - throw an exception, print error message?
|
||||
throw runtime_error("Could not open file " + filepath);
|
||||
throw runtime_error("[#4] Could not open file " + filepath);
|
||||
}
|
||||
T* ret = read(file,filepath,object);
|
||||
file.close();
|
||||
|
Reference in New Issue
Block a user