mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 14:11:15 +02:00
- added the ability for advanced translation features (transifex users can download and remove custom files from the transfex website and test their work)
This commit is contained in:
@@ -2093,6 +2093,32 @@ bool searchAndReplaceTextInFile(string fileName, string findText, string replace
|
||||
return replacedText;
|
||||
}
|
||||
|
||||
void saveDataToFile(string filename, string data) {
|
||||
//Open an input and output stream in binary mode
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
FILE *fp2 = _wfopen(utf8_decode(filename).c_str(), L"wb");
|
||||
ofstream out(fp2);
|
||||
#else
|
||||
ofstream out(filename.c_str(),ios::binary);
|
||||
#endif
|
||||
|
||||
if(out.is_open()) {
|
||||
out<< data;
|
||||
}
|
||||
else if(out.is_open() == false) {
|
||||
throw megaglest_runtime_error("cannot open input file [" + filename + "]");
|
||||
}
|
||||
|
||||
//Close file
|
||||
out.close();
|
||||
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
if(fp2) {
|
||||
fclose(fp2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void copyFileTo(string fromFileName, string toFileName) {
|
||||
//Open an input and output stream in binary mode
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
|
Reference in New Issue
Block a user