mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
fix for folders in demo browser
This commit is contained in:
parent
22f11d6839
commit
8e8cbdb562
|
@ -863,6 +863,7 @@ int fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, void *user)
|
|||
/* add all the entries */
|
||||
do
|
||||
{
|
||||
if(finddata.cFileName[0] != '.')
|
||||
cb(finddata.cFileName, 0, user);
|
||||
} while (FindNextFileA(handle, &finddata));
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -380,7 +380,7 @@ 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;
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue