summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-strategy/glest/files/glest-2.0.1-home.patch')
-rw-r--r--games-strategy/glest/files/glest-2.0.1-home.patch86
1 files changed, 0 insertions, 86 deletions
diff --git a/games-strategy/glest/files/glest-2.0.1-home.patch b/games-strategy/glest/files/glest-2.0.1-home.patch
deleted file mode 100644
index 8690e47576e4..000000000000
--- a/games-strategy/glest/files/glest-2.0.1-home.patch
+++ /dev/null
@@ -1,86 +0,0 @@
---- source/glest_game/main/main.cpp
-+++ source/glest_game/main/main.cpp
-@@ -13,6 +13,7 @@
-
- #include <string>
- #include <cstdlib>
-+#include <sys/stat.h>
-
- #include "game.h"
- #include "main_menu.h"
-@@ -129,6 +130,17 @@
- ExceptionHandler exceptionHandler;
- exceptionHandler.install();
-
-+ if (!getenv("HOME"))
-+ throw runtime_error("HOME not set!");
-+
-+ char str[PATH_MAX];
-+ snprintf(str, PATH_MAX, "%s/.glest", getenv("HOME"));
-+ mkdir(str, 0750);
-+ chdir(str);
-+ mkdir("screens", 0750);
-+
-+ chdir("GENTOO_DATADIR");
-+
- try{
- Config &config = Config::getInstance();
-
---- source/glest_game/main/program.cpp
-+++ source/glest_game/main/program.cpp
-@@ -65,8 +65,11 @@
- updateCameraTimer.init(config.getInt("CameraFps"), maxTimes);
-
- //log start
-+ char str[PATH_MAX];
-+ snprintf(str, PATH_MAX, "%s/.glest/glest.log", getenv("HOME"));
-+
- Logger &logger= Logger::getInstance();
-- logger.setFile("glest.log");
-+ logger.setFile(str);
- logger.clear();
-
- srand(time(NULL));
-@@ -134,9 +137,10 @@
- //save screen
- if(key=='T'){
- for(int i=0; i<100; ++i){
-- string path= "screens/screen" + intToStr(i) + ".tga";
-+ char path[PATH_MAX];
-+ snprintf(path, PATH_MAX, "%s/.glest/screens/screen%d.tga", getenv("HOME"), i);
-
-- FILE *f= fopen(path.c_str(), "rb");
-+ FILE *f= fopen(path, "rb");
- if(f==NULL){
- Renderer::getInstance().saveScreen(path);
- break;
-
---- source/shared_lib/sources/util/properties.cpp
-+++ source/shared_lib/sources/util/properties.cpp
-@@ -33,9 +33,13 @@
-
- this->path= path;
-
-- fileStream.open(path.c_str(), ios_base::in);
-+ char str[PATH_MAX];
-+ snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str());
-+ fileStream.open(str, ios_base::in);
- if(fileStream.fail()){
-- throw runtime_error("Can't open properties file: " + path);
-+ fileStream.open(path.c_str(), ios_base::in); // use defaults
-+ if(fileStream.fail())
-+ throw runtime_error("Can't open properties file: " + path);
- }
-
- properties.clear();
-@@ -70,7 +74,9 @@
- void Properties::save(const string &path){
- ofstream fileStream;
-
-- fileStream.open(path.c_str(), ios_base::out | ios_base::trunc);
-+ char str[PATH_MAX];
-+ snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str());
-+ fileStream.open(str, ios_base::out | ios_base::trunc);
-
- fileStream << "; === Properties File === \n";
- fileStream << '\n';