fixed typo. improved code. add a check for dirs.

This commit is contained in:
AnxietyWump 2020-05-21 16:39:41 -07:00
parent 9c35a3e401
commit e29efce086
2 changed files with 17 additions and 14 deletions

View File

@ -98,21 +98,16 @@ namespace dsu
dir = opendir(path.c_str());
if(dir != NULL)
{
for (const auto & ft : fs::directory_iterator(path))
for (auto ft : fs::directory_iterator(path))
{
string file;
// Check if the fs in question is a dir (we don't want to list dirs, only files).
if(ft.is_directory()) continue;
string ext = ft.path().extension().string();
string fname = ft.path().filename().string();;
string fextname = ext + fname;
string fnamext = fname + ext;
if(ext == "")
{
file = fname;
} else
{
file = fextname;
}
files.push_back(file);
files.push_back(fnamext);
}
}

View File

@ -15,11 +15,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <switch.h>
#include <Swurl.hpp>
#include "FileManager.hpp"
#include "AssetManager.hpp"
#include "ConfigManager.hpp"
#include "SceneDirector.hpp"
@ -33,9 +35,15 @@ int main(int argc, char **argv)
SessionManager::initialize();
SessionManager::userAgent = string("DeepSea-updater/") + VERSION;
#ifdef DEBUG
nxlinkStdio();
#endif
nxlinkStdio();
vector<string> f = FileManager::getExistingFiles("sdmc:/switch");
for(auto i : f)
{
cout << i << "\n";
continue;
}
ConfigManager::initialize();