about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authorChoupom <andycootlapin@hotmail.fr>2010-06-07 17:27:16 +0800
committerMagnus Auvinen <magnus.auvinen@gmail.com>2010-06-10 20:38:16 +0800
commit8e8cbdb562fd264fa52963a30b03016954268aa4 (patch)
tree4b633e93685e82d7f74d732c489fa57a1f4c63a7 /src/game
parent22f11d6839599bc3fecd6b8e2b5394b58d6a7eda (diff)
downloadzcatch-8e8cbdb562fd264fa52963a30b03016954268aa4.tar.gz
zcatch-8e8cbdb562fd264fa52963a30b03016954268aa4.zip
fix for folders in demo browser
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/components/menus.h1
-rw-r--r--src/game/client/components/menus_demo.cpp15
2 files changed, 5 insertions, 11 deletions
diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h
index 229fce80..9ea9c6ef 100644
--- a/src/game/client/components/menus.h
+++ b/src/game/client/components/menus.h
@@ -165,7 +165,6 @@ class CMenus : public CComponent
 	void DemolistPopulate();
 	static void DemolistCountCallback(const char *pName, int IsDir, void *pUser);
 	static void DemolistFetchCallback(const char *pName, int IsDir, void *pUser);
-	static void IsDirCallback(const char *pName, int IsDir, void *pUser);
 	void DemoSetParentDirectory();
 	
 	// found in menus.cpp
diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp
index 784212ca..272e28c8 100644
--- a/src/game/client/components/menus_demo.cpp
+++ b/src/game/client/components/menus_demo.cpp
@@ -380,9 +380,9 @@ struct FETCH_CALLBACKINFO
 
 void CMenus::DemolistFetchCallback(const char *pName, int IsDir, void *pUser)
 {
-	if(IsDir || pName[0] == '.')
+	if(pName[0] == '.')
 		return;
-			
+	
 	FETCH_CALLBACKINFO *pInfo = (FETCH_CALLBACKINFO *)pUser;
 	
 	CDemoItem Item;
@@ -391,11 +391,6 @@ void CMenus::DemolistFetchCallback(const char *pName, int IsDir, void *pUser)
 	pInfo->m_pSelf->m_lDemos.add(Item);
 }
 
-void CMenus::IsDirCallback(const char *pName, int IsDir, void *pUser)
-{
-	*((bool *)pUser) = true;
-}
-
 void CMenus::DemolistPopulate()
 {
 	m_lDemos.clear();
@@ -413,7 +408,7 @@ void CMenus::DemolistPopulate()
 	char aBuf[512];
 	str_format(aBuf, sizeof(aBuf), "%s/%s", Client()->UserDirectory(), m_aCurrentDemoFolder);
 	
-	FETCH_CALLBACKINFO Info = {this, aBuf, 0};
+	FETCH_CALLBACKINFO Info = {this, aBuf, m_aCurrentDemoFolder[6]}; //skip "demos/"
 	fs_listdir(aBuf, DemolistFetchCallback, &Info);
 	Info.m_pPrefix = m_aCurrentDemoFolder;
 	fs_listdir(m_aCurrentDemoFolder, DemolistFetchCallback, &Info);
@@ -459,8 +454,8 @@ void CMenus::RenderDemoList(CUIRect MainView)
 	bool IsDir = false;
 	if(!strncmp(m_lDemos[s_SelectedItem].m_aName, "..", 256)) //parent folder
 		IsDir = true;
-	else
-		fs_listdir(m_lDemos[s_SelectedItem].m_aFilename, IsDirCallback, &IsDir);
+	else if(fs_is_dir(m_lDemos[s_SelectedItem].m_aFilename))
+		IsDir = true;
 	
 	
 	static int s_RefreshButton = 0;