- misc logs and screenshots now also go in userdata folder
This commit is contained in:
parent
0e1b8e62e4
commit
819831a287
|
@ -730,7 +730,7 @@ void MainWindow::saveScreenshot() {
|
|||
//string fileFormat = config.getString("ScreenShotFileType","png");
|
||||
string fileFormat = "png";
|
||||
|
||||
for(int i=0; i < 1000; ++i) {
|
||||
for(int i=0; i < 5000; ++i) {
|
||||
path = screenShotsPath;
|
||||
path += string("screen") + intToStr(i) + string(".") + fileFormat;
|
||||
FILE *f= fopen(path.c_str(), "rb");
|
||||
|
|
|
@ -37,8 +37,18 @@ const int Logger::logLineCount= 15;
|
|||
|
||||
Logger::Logger() {
|
||||
string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey);
|
||||
|
||||
fileName= logs_path + "log.txt";
|
||||
if(logs_path != "") {
|
||||
fileName= logs_path + "log.txt";
|
||||
}
|
||||
else {
|
||||
string userData = Config::getInstance().getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
if(userData != "" && EndsWith(userData, "/") == false && EndsWith(userData, "\\") == false) {
|
||||
userData += "/";
|
||||
}
|
||||
}
|
||||
fileName= userData + "log.txt";
|
||||
}
|
||||
loadingTexture=NULL;
|
||||
showProgressBar = false;
|
||||
}
|
||||
|
|
|
@ -688,15 +688,22 @@ void MainWindow::eventKeyDown(char key){
|
|||
config.reload();
|
||||
}
|
||||
else if(key == configKeys.getCharKey("Screenshot")) {
|
||||
string path = GameConstants::folder_path_screenshots;
|
||||
string userData = Config::getInstance().getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
if(userData != "" && EndsWith(userData, "/") == false && EndsWith(userData, "\\") == false) {
|
||||
userData += "/";
|
||||
}
|
||||
}
|
||||
|
||||
string path = userData + GameConstants::folder_path_screenshots;
|
||||
if(isdir(path.c_str()) == true) {
|
||||
Config &config= Config::getInstance();
|
||||
string fileFormat = config.getString("ScreenShotFileType","png");
|
||||
|
||||
unsigned int queueSize = Renderer::getInstance().getSaveScreenQueueSize();
|
||||
|
||||
for(int i=0; i < 250; ++i) {
|
||||
path = GameConstants::folder_path_screenshots;
|
||||
for(int i=0; i < 5000; ++i) {
|
||||
path = userData + GameConstants::folder_path_screenshots;
|
||||
path += string("screen") + intToStr(i + queueSize) + string(".") + fileFormat;
|
||||
FILE *f= fopen(path.c_str(), "rb");
|
||||
if(f == NULL) {
|
||||
|
@ -1760,7 +1767,14 @@ int glestMain(int argc, char** argv) {
|
|||
gameInitialized = true;
|
||||
|
||||
// Setup the screenshots folder
|
||||
string screenShotsPath = GameConstants::folder_path_screenshots;
|
||||
string userData = config.getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
if(userData != "" && EndsWith(userData, "/") == false && EndsWith(userData, "\\") == false) {
|
||||
userData += "/";
|
||||
}
|
||||
}
|
||||
|
||||
string screenShotsPath = userData + GameConstants::folder_path_screenshots;
|
||||
if(isdir(screenShotsPath.c_str()) == false) {
|
||||
createDirectoryPaths(screenShotsPath);
|
||||
}
|
||||
|
|
|
@ -491,6 +491,16 @@ void Program::init(WindowGl *window, bool initSound, bool toggleFullScreen){
|
|||
string logFile = "glest.log";
|
||||
if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
|
||||
logFile = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + logFile;
|
||||
}
|
||||
else {
|
||||
string userData = config.getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
if(userData != "" && EndsWith(userData, "/") == false && EndsWith(userData, "\\") == false) {
|
||||
userData += "/";
|
||||
}
|
||||
}
|
||||
|
||||
logFile = userData + logFile;
|
||||
}
|
||||
logger.setFile(logFile);
|
||||
logger.clear();
|
||||
|
|
|
@ -1594,6 +1594,15 @@ std::string World::DumpWorldToLog(bool consoleBasicInfoOnly) const {
|
|||
if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
|
||||
debugWorldLogFile = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + debugWorldLogFile;
|
||||
}
|
||||
else {
|
||||
string userData = Config::getInstance().getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
if(userData != "" && EndsWith(userData, "/") == false && EndsWith(userData, "\\") == false) {
|
||||
userData += "/";
|
||||
}
|
||||
}
|
||||
debugWorldLogFile = userData + debugWorldLogFile;
|
||||
}
|
||||
|
||||
if(consoleBasicInfoOnly == true) {
|
||||
std::cout << "World debug information:" << std::endl;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
|
@ -75,6 +75,15 @@ Profiler::~Profiler(){
|
|||
string profileLog = "profiler.log";
|
||||
if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
|
||||
profileLog = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + profileLog;
|
||||
}
|
||||
else {
|
||||
string userData = config.getString("UserData_Root","");
|
||||
if(userData != "") {
|
||||
if(userData != "" && EndsWith(userData, "/") == false && EndsWith(userData, "\\") == false) {
|
||||
userData += "/";
|
||||
}
|
||||
}
|
||||
profileLog = userData + profileLog;
|
||||
}
|
||||
FILE *f= fopen(profileLog.c_str(), "w");
|
||||
if(f==NULL)
|
||||
|
|
Loading…
Reference in New Issue