mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
fix for folders in demo browser
This commit is contained in:
parent
22f11d6839
commit
8e8cbdb562
|
@ -863,7 +863,8 @@ int fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, void *user)
|
||||||
/* add all the entries */
|
/* add all the entries */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
cb(finddata.cFileName, 0, user);
|
if(finddata.cFileName[0] != '.')
|
||||||
|
cb(finddata.cFileName, 0, user);
|
||||||
} while (FindNextFileA(handle, &finddata));
|
} while (FindNextFileA(handle, &finddata));
|
||||||
|
|
||||||
FindClose(handle);
|
FindClose(handle);
|
||||||
|
|
|
@ -165,7 +165,6 @@ class CMenus : public CComponent
|
||||||
void DemolistPopulate();
|
void DemolistPopulate();
|
||||||
static void DemolistCountCallback(const char *pName, int IsDir, void *pUser);
|
static void DemolistCountCallback(const char *pName, int IsDir, void *pUser);
|
||||||
static void DemolistFetchCallback(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();
|
void DemoSetParentDirectory();
|
||||||
|
|
||||||
// found in menus.cpp
|
// found in menus.cpp
|
||||||
|
|
|
@ -380,7 +380,7 @@ struct FETCH_CALLBACKINFO
|
||||||
|
|
||||||
void CMenus::DemolistFetchCallback(const char *pName, int IsDir, void *pUser)
|
void CMenus::DemolistFetchCallback(const char *pName, int IsDir, void *pUser)
|
||||||
{
|
{
|
||||||
if(IsDir || pName[0] == '.')
|
if(pName[0] == '.')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FETCH_CALLBACKINFO *pInfo = (FETCH_CALLBACKINFO *)pUser;
|
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);
|
pInfo->m_pSelf->m_lDemos.add(Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenus::IsDirCallback(const char *pName, int IsDir, void *pUser)
|
|
||||||
{
|
|
||||||
*((bool *)pUser) = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMenus::DemolistPopulate()
|
void CMenus::DemolistPopulate()
|
||||||
{
|
{
|
||||||
m_lDemos.clear();
|
m_lDemos.clear();
|
||||||
|
@ -413,7 +408,7 @@ void CMenus::DemolistPopulate()
|
||||||
char aBuf[512];
|
char aBuf[512];
|
||||||
str_format(aBuf, sizeof(aBuf), "%s/%s", Client()->UserDirectory(), m_aCurrentDemoFolder);
|
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);
|
fs_listdir(aBuf, DemolistFetchCallback, &Info);
|
||||||
Info.m_pPrefix = m_aCurrentDemoFolder;
|
Info.m_pPrefix = m_aCurrentDemoFolder;
|
||||||
fs_listdir(m_aCurrentDemoFolder, DemolistFetchCallback, &Info);
|
fs_listdir(m_aCurrentDemoFolder, DemolistFetchCallback, &Info);
|
||||||
|
@ -459,8 +454,8 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
||||||
bool IsDir = false;
|
bool IsDir = false;
|
||||||
if(!strncmp(m_lDemos[s_SelectedItem].m_aName, "..", 256)) //parent folder
|
if(!strncmp(m_lDemos[s_SelectedItem].m_aName, "..", 256)) //parent folder
|
||||||
IsDir = true;
|
IsDir = true;
|
||||||
else
|
else if(fs_is_dir(m_lDemos[s_SelectedItem].m_aFilename))
|
||||||
fs_listdir(m_lDemos[s_SelectedItem].m_aFilename, IsDirCallback, &IsDir);
|
IsDir = true;
|
||||||
|
|
||||||
|
|
||||||
static int s_RefreshButton = 0;
|
static int s_RefreshButton = 0;
|
||||||
|
|
Loading…
Reference in a new issue