mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 21:54:15 +01:00
-added subdirectory reading for music files, means you now
finally can have your albums in the music folder organized ;)
This commit is contained in:
parent
8ad310f4dc
commit
84cf561172
@ -79,7 +79,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage,
|
||||
gprintf("Calling list to update filelist\n");
|
||||
|
||||
vector<string> pathlist;
|
||||
list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL)));
|
||||
list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL)), music);
|
||||
list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin);
|
||||
|
||||
path.append("/touch.db");
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "gc.h"
|
||||
|
||||
template <typename T>
|
||||
void CList<T>::GetPaths(vector<string> &pathlist, string containing, string directory, bool wbfs_fs, bool dml)
|
||||
void CList<T>::GetPaths(vector<string> &pathlist, string containing, string directory, bool wbfs_fs, bool dml, bool music)
|
||||
{
|
||||
if (!wbfs_fs)
|
||||
{
|
||||
@ -44,12 +44,12 @@ void CList<T>::GetPaths(vector<string> &pathlist, string containing, string dire
|
||||
if(temp_pathlist.size() > 0)
|
||||
{
|
||||
bool FoundDMLgame;
|
||||
for(vector<string>::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++)
|
||||
for(u32 i = 0; i < temp_pathlist.size(); i++)
|
||||
{
|
||||
if((*templist).size() == 0)
|
||||
if(temp_pathlist[i].size() == 0)
|
||||
continue;
|
||||
|
||||
dir_itr = opendir((*templist).c_str());
|
||||
dir_itr = opendir(temp_pathlist[i].c_str());
|
||||
if(!dir_itr)
|
||||
continue;
|
||||
|
||||
@ -58,32 +58,38 @@ void CList<T>::GetPaths(vector<string> &pathlist, string containing, string dire
|
||||
/* Read secondary entries */
|
||||
while((ent = readdir(dir_itr)) != NULL)
|
||||
{
|
||||
if(ent->d_type == DT_REG && strlen(ent->d_name) > 7)
|
||||
if (ent->d_name[0] == '.') continue;
|
||||
if(ent->d_type == DT_REG && (strlen(ent->d_name) > 7 || music))
|
||||
{
|
||||
for(vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++)
|
||||
{
|
||||
if(strcasestr(ent->d_name, (*compare).c_str()) != NULL)
|
||||
{
|
||||
FoundDMLgame = true;
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s", (*templist).c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s", (*templist).c_str(), ent->d_name));
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s", temp_pathlist[i].c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s", temp_pathlist[i].c_str(), ent->d_name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(music)
|
||||
temp_pathlist.push_back(sfmt("%s/%s", temp_pathlist[i].c_str(), ent->d_name));
|
||||
else if(dml && !FoundDMLgame && strncasecmp(ent->d_name, "sys", 3) == 0)
|
||||
{
|
||||
FILE *f;
|
||||
f = fopen(fmt("%s/%s/boot.bin", (*templist).c_str(), ent->d_name), "rb");
|
||||
f = fopen(fmt("%s/%s/boot.bin", temp_pathlist[i].c_str(), ent->d_name), "rb");
|
||||
if(f)
|
||||
{
|
||||
fclose(f);
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s/boot.bin", (*templist).c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s/boot.bin", (*templist).c_str(), ent->d_name));
|
||||
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s/boot.bin", temp_pathlist[i].c_str(), ent->d_name).c_str());
|
||||
pathlist.push_back(sfmt("%s/%s/boot.bin", temp_pathlist[i].c_str(), ent->d_name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir_itr);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class CList
|
||||
public:
|
||||
CList(){};
|
||||
~CList(){};
|
||||
void GetPaths(vector<string> &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false);
|
||||
void GetPaths(vector<string> &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false, bool music = false);
|
||||
void GetHeaders(vector<string> pathlist, vector<T> &headerlist, string, string, string, Config &plugin);
|
||||
void GetChannels(vector<T> &headerlist, string, u32, string);
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user