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

Collapse All | Expand All

(-)megaglest-source-3.4.0.old/source/glest_game/ai/ai_interface.h (-1 / +5 lines)
Lines 95-101 Link Here
95
	bool isFreeCells(const Vec2i &pos, int size, Field field);
95
	bool isFreeCells(const Vec2i &pos, int size, Field field);
96
96
97
private:
97
private:
98
	string getLogFilename() const	{return "ai"+intToStr(factionIndex)+".log";}
98
	string getLogFilename() const	{
99
	  string logfn=getenv("HOME");
100
	  logfn+="/.megaglest/ai"+intToStr(factionIndex)+".log";
101
	  return logfn;
102
	}
99
	bool executeCommandOverNetwork();
103
	bool executeCommandOverNetwork();
100
};
104
};
101
105
(-)megaglest-source-3.4.0.old/source/glest_game/main/main.cpp (+11 lines)
Lines 1408-1413 Link Here
1408
}
1408
}
1409
1409
1410
int glestMain(int argc, char** argv) {
1410
int glestMain(int argc, char** argv) {
1411
    if (!getenv("HOME"))
1412
    throw runtime_error("HOME external variable is not set");
1413
  
1414
    char path[PATH_MAX];
1415
    snprintf(path, PATH_MAX, "%s/.megaglest", getenv("HOME"));
1416
    mkdir(path, 0750);
1417
 
1418
    snprintf(path, PATH_MAX, "%s/.megaglest/screens", getenv("HOME"));
1419
    mkdir(path, 0750);
1420
    
1421
    chdir("@GENTOO_DATADIR@");
1411
#ifdef SL_LEAK_DUMP
1422
#ifdef SL_LEAK_DUMP
1412
	AllocRegistry memoryLeaks = AllocRegistry::getInstance();
1423
	AllocRegistry memoryLeaks = AllocRegistry::getInstance();
1413
#endif
1424
#endif
(-)megaglest-source-3.4.0.old/source/glest_game/main/program.cpp (-1 / +3 lines)
Lines 488-494 Link Here
488
488
489
    //log start
489
    //log start
490
	Logger &logger= Logger::getInstance();
490
	Logger &logger= Logger::getInstance();
491
	string logFile = "glest.log";
491
	string a=getenv("HOME");
492
	string b= "/.megaglest/glest.log";
493
	string logFile = a+b;
492
    if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
494
    if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
493
        logFile = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + logFile;
495
        logFile = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + logFile;
494
    }
496
    }
(-)megaglest-source-3.4.0.old/source/shared_lib/sources/util/leak_dumper.cpp (-1 / +3 lines)
Lines 43-49 Link Here
43
43
44
AllocRegistry::~AllocRegistry(){
44
AllocRegistry::~AllocRegistry(){
45
45
46
	dump("leak_dump.log");
46
	char path[PATH_MAX];
47
	snprintf(path, PATH_MAX, "%s/.megaglest/leak_dump.log", getenv("HOME"));
48
	dump(path);
47
}
49
}
48
50
49
void AllocRegistry::allocate(AllocInfo info){
51
void AllocRegistry::allocate(AllocInfo info){
(-)megaglest-source-3.4.0.old/source/shared_lib/sources/util/profiler.cpp (-2 / +4 lines)
Lines 76-84 Link Here
76
    if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
76
    if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
77
        profileLog = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + profileLog;
77
        profileLog = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + profileLog;
78
    }
78
    }
79
	FILE *f= fopen(profileLog.c_str(), "w");
79
	char path[PATH_MAX];
80
	snprintf(path, PATH_MAX, "%s/.magaglest/profiler.log", getenv("HOME"));
81
	FILE *f= fopen(path, "w");
80
	if(f==NULL)
82
	if(f==NULL)
81
		throw runtime_error("Can not open file: " + profileLog);
83
		throw runtime_error("Can not open file: %s",path);
82
84
83
	fprintf(f, "Profiler Results\n\n");
85
	fprintf(f, "Profiler Results\n\n");
84
86
(-)megaglest-source-3.4.0.old/source/shared_lib/sources/util/properties.cpp (-5 / +13 lines)
Lines 14-20 Link Here
14
#include <fstream>
14
#include <fstream>
15
#include <stdexcept>
15
#include <stdexcept>
16
#include <cstring>
16
#include <cstring>
17
17
#include <limits.h>
18
#include <stdlib.h>
18
#include "conversion.h"
19
#include "conversion.h"
19
#include "util.h"
20
#include "util.h"
20
#include "leak_dumper.h"
21
#include "leak_dumper.h"
Lines 38-47 Link Here
38
39
39
    //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
40
    //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
40
41
41
	fileStream.open(path.c_str(), ios_base::in);
42
	char str[PATH_MAX];
43
	snprintf(str, PATH_MAX, "%s/.megaglest/%s", getenv("HOME"), path.c_str());
44
	fileStream.open(str, ios_base::in);
42
	if(fileStream.fail()){
45
	if(fileStream.fail()){
43
	    SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
46
		fileStream.open(path.c_str(), ios_base::in); // use defaults
44
		throw runtime_error("Can't open propertyMap file: " + path);
47
		if(fileStream.fail()){
48
			SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
49
			throw runtime_error("Can't open propertyMap file: " + path + " cwd: "+ getenv("PWD"));
50
		}
45
	}
51
	}
46
52
47
    //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
53
    //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
Lines 78-84 Link Here
78
void Properties::save(const string &path){
84
void Properties::save(const string &path){
79
	ofstream fileStream;
85
	ofstream fileStream;
80
86
81
	fileStream.open(path.c_str(), ios_base::out | ios_base::trunc);
87
	char str[PATH_MAX];
88
	snprintf(str, PATH_MAX, "%s/.megaglest/%s", getenv("HOME"), path.c_str());
89
	fileStream.open(str, ios_base::out | ios_base::trunc);
82
90
83
	fileStream << "; === propertyMap File === \n";
91
	fileStream << "; === propertyMap File === \n";
84
	fileStream << '\n';
92
	fileStream << '\n';

Return to bug 340343