From b8095edbb559c249feef40f733e7269fd9eb2741 Mon Sep 17 00:00:00 2001 From: Chris Brooke Date: Sat, 14 Jul 2012 10:46:48 +0100 Subject: [PATCH 1/2] Snapshots fixed --- radiant/qe3.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index f9336f1..6fd4302 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -148,7 +148,6 @@ bool DoesFileExist( const char* pBuff, long& lSize ){ return false; } - void Map_Snapshot(){ CString strMsg; @@ -183,11 +182,22 @@ void Map_Snapshot(){ CString strNewPath; strNewPath = strOrgPath; strNewPath += strOrgFile; + + // QB - snapshots now follow the format: .. + // **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; while ( bGo ) { 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; bGo = DoesFileExist( strFile, lSize ); nCount++; From 52cf5eddb09a186fd466574e5f7e4590ed03d92d Mon Sep 17 00:00:00 2001 From: Chris Brooke Date: Sat, 14 Jul 2012 10:52:33 +0100 Subject: [PATCH 2/2] Having more than one game configured now works --- radiant/preferences.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index da42e67..844e822 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -3413,10 +3413,14 @@ void CGameInstall::Run() { // write out the game file Str gameFilePath = g_strAppPath.GetBuffer(); - gameFilePath += "games/"; + gameFilePath += "games"; if ( CheckFile( gameFilePath ) != PATH_DIRECTORY ) { 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 ] ) { case GAME_Q2: