mirror of
https://gitea.sffnetwork.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-11-21 18:09:47 +00:00
the whole game
This commit is contained in:
parent
816e9060b4
commit
f0617a5d22
2069 changed files with 581500 additions and 0 deletions
37
src/client/OptionsFile.cpp
Executable file
37
src/client/OptionsFile.cpp
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#include "OptionsFile.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
OptionsFile::OptionsFile() {
|
||||
#ifdef __APPLE__
|
||||
settingsPath = "./Documents/options.txt";
|
||||
#elif defined(ANDROID)
|
||||
settingsPath = "options.txt";
|
||||
#else
|
||||
settingsPath = "options.txt";
|
||||
#endif
|
||||
}
|
||||
|
||||
void OptionsFile::save(const StringVector& settings) {
|
||||
FILE* pFile = fopen(settingsPath.c_str(), "w");
|
||||
if(pFile != NULL) {
|
||||
for(StringVector::const_iterator it = settings.begin(); it != settings.end(); ++it) {
|
||||
fprintf(pFile, "%s\n", it->c_str());
|
||||
}
|
||||
fclose(pFile);
|
||||
}
|
||||
}
|
||||
|
||||
StringVector OptionsFile::getOptionStrings() {
|
||||
StringVector returnVector;
|
||||
FILE* pFile = fopen(settingsPath.c_str(), "w");
|
||||
if(pFile != NULL) {
|
||||
char lineBuff[128];
|
||||
while(fgets(lineBuff, sizeof lineBuff, pFile)) {
|
||||
if(strlen(lineBuff) > 2)
|
||||
returnVector.push_back(std::string(lineBuff));
|
||||
}
|
||||
fclose(pFile);
|
||||
}
|
||||
return returnVector;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue