about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base/system.c3
-rw-r--r--src/game/client/components/menus.h1
-rw-r--r--src/game/client/components/menus_demo.cpp15
3 files changed, 7 insertions, 12 deletions
diff --git a/src/base/system.c b/src/base/system.c
index a1a1b33e..47893aa3 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -863,7 +863,8 @@ int fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, void *user)
 	/* add all the entries */
 	do
 	{
-		cb(finddata.cFileName, 0, user);
+		if(finddata.cFileName[0] != '.')
+			cb(finddata.cFileName, 0, user);
 	} while (FindNextFileA(handle, &finddata));
 
 	FindClose(handle);
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;