mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
- attmpt to auto-create the screens folder at startup to avoid crashes when folder is missing and users try to take a screenshot.
This commit is contained in:
parent
c9393024ce
commit
4e8fdc105c
@ -937,16 +937,19 @@ void Game::keyDown(char key){
|
||||
showFullConsole= true;
|
||||
}
|
||||
else if(key == configKeys.getCharKey("Screenshot")) {
|
||||
for(int i=0; i<100; ++i){
|
||||
string path= "screens/screen" + intToStr(i) + ".tga";
|
||||
|
||||
FILE *f= fopen(path.c_str(), "rb");
|
||||
if(f==NULL){
|
||||
Renderer::getInstance().saveScreen(path);
|
||||
break;
|
||||
}
|
||||
else{
|
||||
fclose(f);
|
||||
string path = GameConstants::folder_path_screenshots;
|
||||
if(isdir(path.c_str()) == true) {
|
||||
for(int i=0; i<100; ++i){
|
||||
path = GameConstants::folder_path_screenshots;
|
||||
path += "screen" + intToStr(i) + ".tga";
|
||||
FILE *f= fopen(path.c_str(), "rb");
|
||||
if(f==NULL) {
|
||||
Renderer::getInstance().saveScreen(path);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
static const char *folder_path_tutorials;
|
||||
|
||||
static const char *NETWORK_SLOT_UNCONNECTED_SLOTNAME;
|
||||
|
||||
static const char *folder_path_screenshots;
|
||||
};
|
||||
|
||||
enum PathType {
|
||||
|
@ -38,6 +38,8 @@ const char *GameConstants::folder_path_tutorials = "tutorials";
|
||||
|
||||
const char *GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME = "???";
|
||||
|
||||
const char *GameConstants::folder_path_screenshots = "screens/";
|
||||
|
||||
// =====================================================
|
||||
// class Config
|
||||
// =====================================================
|
||||
|
@ -663,6 +663,11 @@ int glestMain(int argc, char** argv){
|
||||
|
||||
gameInitialized = true;
|
||||
|
||||
string screenShotsPath = GameConstants::folder_path_screenshots;
|
||||
if(isdir(screenShotsPath.c_str()) == false) {
|
||||
createDirectoryPaths(screenShotsPath);
|
||||
}
|
||||
|
||||
if(config.getBool("AllowGameDataSynchCheck","false") == true) {
|
||||
vector<string> techDataPaths = config.getPathListForType(ptTechs);
|
||||
preCacheThread.reset(new FileCRCPreCacheThread());
|
||||
|
Loading…
x
Reference in New Issue
Block a user