about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-03-31 18:33:46 +0200
committeroy <Tom_Adams@web.de>2011-03-31 18:33:46 +0200
commitcd9176331d1eac1eeaee8d4bdadf06b2a6d8c6e8 (patch)
tree808c22e14dd02af0d4e568edcc73af41063ea5ec /src/game/client
parent0e6aca2b282e51fe00b06db0ba4de1e5c7dac40a (diff)
downloadzcatch-cd9176331d1eac1eeaee8d4bdadf06b2a6d8c6e8.tar.gz
zcatch-cd9176331d1eac1eeaee8d4bdadf06b2a6d8c6e8.zip
auto add .demo if not present when renaming a demo
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/components/menus.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index b7328e06..8a72c425 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -1133,8 +1133,12 @@ int CMenus::Render()
 				{
 					char aBufOld[512];
 					str_format(aBufOld, sizeof(aBufOld), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
+					int Length = str_length(m_aCurrentDemoFile);
 					char aBufNew[512];
-					str_format(aBufNew, sizeof(aBufNew), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
+					if(Length <= 4 || m_aCurrentDemoFile[Length-5] != '.' || str_comp_nocase(m_aCurrentDemoFile+Length-4, "demo"))
+						str_format(aBufNew, sizeof(aBufNew), "%s/%s.demo", m_aCurrentDemoFolder, m_aCurrentDemoFile);
+					else
+						str_format(aBufNew, sizeof(aBufNew), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
 					if(Storage()->RenameFile(aBufOld, aBufNew, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
 					{
 						DemolistPopulate();