Problem: Exception: Error opening log fileglest.log
No logfile could be written because glest needs write accessrights to its installation directory:
Can you fix that problem? In patch, for old glest version, this problem was solved by
respecting $HOME variable. Patch:
--- glest_source_2.0.0/source/glest_game/main/program.cpp.orig 2006-12-01 20:47:26 +0300
+++ glest_source_2.0.0/source/glest_game/main/program.cpp 2006-12-01 20:49:12 +0300
@@ -66,7 +66,10 @@
//log start
Logger &logger= Logger::getInstance();
- logger.setFile("glest.log");
+ string home = getenv("HOME");
+ string logfile = home + "/.glest.log";
+ printf("Logfile patch debug: using %s as logfile\n", logfile.c_str());
+ logger.setFile(logfile.c_str());
logger.clear();
srand(time(NULL));
--- glest_source_2.0.0/source/glest_game/facilities/logger.cpp.orig 2006-12-01 20:47:11 +0300
+++ glest_source_2.0.0/source/glest_game/facilities/logger.cpp 2006-12-01 20:50:07 +0300
@@ -48,7 +48,7 @@
void Logger::add(const string &str, bool renderScreen){
FILE *f=fopen(fileName.c_str(), "at+");
if(f==NULL){
- throw runtime_error("Error opening log file"+ fileName);
+ throw runtime_error("Error opening log file: "+ fileName);
}
fprintf(f, "%s\n", str.c_str());
fclose(f);
@@ -79,7 +79,7 @@
FILE *f= fopen(fileName.c_str(), "wt+");
if(f==NULL){
- throw runtime_error("Error opening log file"+ fileName);
+ throw runtime_error("Error opening log file: "+ fileName);
}
fprintf(f, "%s", s.c_str());
[andy@timelock glest]$
Maybe the other problem is due to a similar problem.
Megaglest ( and glest itself too) is not meant to be installed in /usr/local... in a linux system(yet?).
That's right. If i building program from the source code - installation is in /usr/local/ directory.
When i'm installed program from package - rpm (deb, whatever), binary files installed in /usr/bin
Gest versions which can do this are changed by the package providers manually. Glest needs accessrights to the files ( glest.ini,logfiles...)
Access rights for read, or write?
It should be typically installed in a home directory of a user where all is in place! And don't try to install megaglest over a version which came from your package system, I don't think this will work.
Actually, installation in home directory is a bad idea, because in this directory is my personal data. Software, installed from packages, are
placed in directories, according to
Filesystem Hierarchy Standard. I don't try
install megaglest over glest, i try to roll the package for altlinux, that's why i ask for help.