mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Merge pull request #86 from QBall147/issue#65-snapshots-fix
Issue #65 snapshots fix
This commit is contained in:
commit
e5366326f2
2 changed files with 17 additions and 3 deletions
|
@ -3413,11 +3413,15 @@ void CGameInstall::Run() {
|
||||||
|
|
||||||
// write out the game file
|
// write out the game file
|
||||||
Str gameFilePath = g_strAppPath.GetBuffer();
|
Str gameFilePath = g_strAppPath.GetBuffer();
|
||||||
gameFilePath += "games/";
|
gameFilePath += "games";
|
||||||
if ( CheckFile( gameFilePath ) != PATH_DIRECTORY ) {
|
if ( CheckFile( gameFilePath ) != PATH_DIRECTORY ) {
|
||||||
radCreateDirectory( gameFilePath );
|
radCreateDirectory( gameFilePath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QB - Fix for when you have more than one game configured (before it just bombed out due to the dir already existing).
|
||||||
|
// add the slash here instead of above else CheckFile() fails hard (on windows at least :/ )
|
||||||
|
gameFilePath += "/";
|
||||||
|
|
||||||
switch ( m_availGames[ m_nComboSelect ] ) {
|
switch ( m_availGames[ m_nComboSelect ] ) {
|
||||||
case GAME_Q2:
|
case GAME_Q2:
|
||||||
gameFilePath += "q2.game";
|
gameFilePath += "q2.game";
|
||||||
|
|
|
@ -148,7 +148,6 @@ bool DoesFileExist( const char* pBuff, long& lSize ){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Map_Snapshot(){
|
void Map_Snapshot(){
|
||||||
CString strMsg;
|
CString strMsg;
|
||||||
|
|
||||||
|
@ -183,11 +182,22 @@ void Map_Snapshot(){
|
||||||
CString strNewPath;
|
CString strNewPath;
|
||||||
strNewPath = strOrgPath;
|
strNewPath = strOrgPath;
|
||||||
strNewPath += strOrgFile;
|
strNewPath += strOrgFile;
|
||||||
|
|
||||||
|
// QB - snapshots now follow the format: <mapname>.<snapnum>.<ext>
|
||||||
|
// **NOTE** atm snapshots must end with a .map (or .xmap) ext (this is why they were broken)
|
||||||
|
CString strOldEXT = "map"; //default to .map
|
||||||
|
const char* type = strrchr( strOrgFile.GetBuffer(),'.' );
|
||||||
|
if ( type != NULL ) { strOldEXT = ++type; }; // get the ext for later.
|
||||||
|
StripExtension(strNewPath); // then strip it from the new path
|
||||||
|
//
|
||||||
|
|
||||||
CString strFile;
|
CString strFile;
|
||||||
while ( bGo )
|
while ( bGo )
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
sprintf( buf, "%s.%i", strNewPath.GetBuffer(), nCount );
|
//sprintf( buf, "%s.%i", strNewPath.GetBuffer(), nCount );
|
||||||
|
// snapshot will now end with a known ext.
|
||||||
|
sprintf( buf, "%s.%i.%s", strNewPath.GetBuffer(), nCount, strOldEXT.GetBuffer() );
|
||||||
strFile = buf;
|
strFile = buf;
|
||||||
bGo = DoesFileExist( strFile, lSize );
|
bGo = DoesFileExist( strFile, lSize );
|
||||||
nCount++;
|
nCount++;
|
||||||
|
|
Loading…
Reference in a new issue