Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 118911 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-9 / +31 lines)
Line  Link Here
0
-- source/glest_game/main/main.cpp
0
++ source/glest_game/main/main.cpp
Lines 13-18 Link Here
13
13
14
#include <string>
14
#include <string>
15
#include <cstdlib>
15
#include <cstdlib>
16
#include <sys/stat.h>
16
17
17
#include "game.h"
18
#include "game.h"
18
#include "main_menu.h"
19
#include "main_menu.h"
Lines 129-134 Link Here
129
	ExceptionHandler exceptionHandler;
130
	ExceptionHandler exceptionHandler;
130
	exceptionHandler.install();
131
	exceptionHandler.install();
131
132
133
	if (!getenv("HOME"))
134
		throw runtime_error("HOME not set!");
135
136
	char str[PATH_MAX];
137
	snprintf(str, PATH_MAX, "%s/.glest", getenv("HOME"));
138
	mkdir(str, 0750);
139
	chdir(str);
140
	mkdir("screens", 0750);
141
142
	chdir("GENTOO_DATADIR");
143
132
	try{
144
	try{
133
		Config &config = Config::getInstance();
145
		Config &config = Config::getInstance();
134
146
135
-- source/glest_game/main/program.cpp
147
++ source/glest_game/main/program.cpp
Lines 65-72 Link Here
65
	updateCameraTimer.init(config.getInt("CameraFps"), maxTimes);
65
	updateCameraTimer.init(config.getInt("CameraFps"), maxTimes);
66
66
67
    //log start
67
    //log start
68
	char str[PATH_MAX];
69
	snprintf(str, PATH_MAX, "%s/.glest/glest.log", getenv("HOME"));
70
68
	Logger &logger= Logger::getInstance();
71
	Logger &logger= Logger::getInstance();
69
	logger.setFile("glest.log");
72
	logger.setFile(str);
70
	logger.clear();
73
	logger.clear();
71
    
74
    
72
	srand(time(NULL));
75
	srand(time(NULL));
Lines 134-142 Link Here
134
	//save screen 
137
	//save screen 
135
	if(key=='T'){
138
	if(key=='T'){
136
		for(int i=0; i<100; ++i){
139
		for(int i=0; i<100; ++i){
137
			string path= "screens/screen" + intToStr(i) + ".tga";
140
			char path[PATH_MAX];
141
			snprintf(path, PATH_MAX, "%s/.glest/screens/screen%d.tga", getenv("HOME"), i);
138
			
142
			
139
			FILE *f= fopen(path.c_str(), "rb");
143
			FILE *f= fopen(path, "rb");
140
			if(f==NULL){
144
			if(f==NULL){
141
				Renderer::getInstance().saveScreen(path);
145
				Renderer::getInstance().saveScreen(path);
142
				break;
146
				break;
143
-- source/shared_lib/sources/util/properties.cpp
147
++ source/shared_lib/sources/util/properties.cpp
Lines 33-41 Link Here
33
33
34
	this->path= path;
34
	this->path= path;
35
35
36
	fileStream.open(path.c_str(), ios_base::in);
36
	char str[PATH_MAX];
37
	snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str());
38
	fileStream.open(str, ios_base::in);
37
	if(fileStream.fail()){
39
	if(fileStream.fail()){
38
		throw runtime_error("Can't open properties file: " + path);
40
		fileStream.open(path.c_str(), ios_base::in); // use defaults
41
		if(fileStream.fail())
42
			throw runtime_error("Can't open properties file: " + path);
39
	}
43
	}
40
44
41
	properties.clear();
45
	properties.clear();
Lines 70-76 Link Here
70
void Properties::save(const string &path){
74
void Properties::save(const string &path){
71
	ofstream fileStream;
75
	ofstream fileStream;
72
76
73
	fileStream.open(path.c_str(), ios_base::out | ios_base::trunc);
77
	char str[PATH_MAX];
78
	snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str());
79
	fileStream.open(str, ios_base::out | ios_base::trunc);
74
80
75
	fileStream << "; === Properties File === \n";	
81
	fileStream << "; === Properties File === \n";	
76
	fileStream << '\n';
82
	fileStream << '\n';

Return to bug 118911