mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 07:31:21 +02:00
- bugfix for press screen shot hotkey in windows
This commit is contained in:
@@ -677,8 +677,10 @@ int glestMain(int argc, char** argv){
|
|||||||
gameInitialized = true;
|
gameInitialized = true;
|
||||||
|
|
||||||
string screenShotsPath = GameConstants::folder_path_screenshots;
|
string screenShotsPath = GameConstants::folder_path_screenshots;
|
||||||
|
//printf("In [%s::%s Line: %d] screenShotsPath [%s]\n",__FILE__,__FUNCTION__,__LINE__,screenShotsPath.c_str());
|
||||||
if(isdir(screenShotsPath.c_str()) == false) {
|
if(isdir(screenShotsPath.c_str()) == false) {
|
||||||
createDirectoryPaths(screenShotsPath);
|
createDirectoryPaths(screenShotsPath);
|
||||||
|
//printf("In [%s::%s Line: %d] screenShotsPath [%s]\n",__FILE__,__FUNCTION__,__LINE__,screenShotsPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config.getBool("AllowGameDataSynchCheck","false") == true) {
|
if(config.getBool("AllowGameDataSynchCheck","false") == true) {
|
||||||
|
@@ -272,9 +272,28 @@ void findAll(const string &path, vector<string> &results, bool cutExtension, boo
|
|||||||
|
|
||||||
bool isdir(const char *path)
|
bool isdir(const char *path)
|
||||||
{
|
{
|
||||||
struct stat stats;
|
string friendly_path = path;
|
||||||
|
|
||||||
bool ret = stat (path, &stats) == 0 && S_ISDIR(stats.st_mode);
|
#ifdef WIN32
|
||||||
|
replaceAll(friendly_path, "/", "\\");
|
||||||
|
if(EndsWith(friendly_path, "\\") == true) {
|
||||||
|
friendly_path.erase(friendly_path.begin() + friendly_path.length() -1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct stat stats;
|
||||||
|
int result = stat(friendly_path.c_str(), &stats);
|
||||||
|
bool ret = (result == 0);
|
||||||
|
if(ret == true) {
|
||||||
|
ret = S_ISDIR(stats.st_mode); // #define S_ISDIR(mode) ((mode) & _S_IFDIR)
|
||||||
|
|
||||||
|
if(ret == false) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path [%s] ret = %d\n",__FILE__,__FUNCTION__,__LINE__,friendly_path.c_str(),ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path [%s] ret = %d, result = %d, errno = %d\n",__FILE__,__FUNCTION__,__LINE__,friendly_path.c_str(),ret,result,errno);
|
||||||
|
}
|
||||||
//if(ret == false) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] NOT a path [%s]\n",__FILE__,__FUNCTION__,__LINE__,path);
|
//if(ret == false) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] NOT a path [%s]\n",__FILE__,__FUNCTION__,__LINE__,path);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -595,12 +614,13 @@ void createDirectoryPaths(string Path)
|
|||||||
//if (':' != *(path-1))
|
//if (':' != *(path-1))
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
_mkdir(DirName);
|
int result = _mkdir(DirName);
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
mkdir(DirName, S_IRWXU | S_IRWXO | S_IRWXG);
|
int result = mkdir(DirName, S_IRWXU | S_IRWXO | S_IRWXG);
|
||||||
#else
|
#else
|
||||||
#error "Your compiler needs to support mkdir!"
|
#error "Your compiler needs to support mkdir!"
|
||||||
#endif
|
#endif
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] DirName [%s] result = %d, errno = %d\n",__FILE__,__FUNCTION__,__LINE__,DirName,result,errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dirName++ = *path++;
|
*dirName++ = *path++;
|
||||||
|
Reference in New Issue
Block a user