Commit 52db9d6b authored by nanahira's avatar nanahira

fix problems with files without extension

parent 9238d44e
......@@ -861,7 +861,7 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
}
void Game::LoadExpansionDB() {
FileSystem::TraversalDir("./expansions", [](const char* name, bool isdir) {
if(!isdir && !mystrncasecmp(strrchr(name, '.'), ".cdb", 4)) {
if(!isdir && strrchr(name, '.') && !mystrncasecmp(strrchr(name, '.'), ".cdb", 4)) {
char fpath[1024];
sprintf(fpath, "./expansions/%s", name);
dataManager.LoadDB(fpath);
......@@ -871,7 +871,7 @@ void Game::LoadExpansionDB() {
void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
cbDeck->clear();
FileSystem::TraversalDir(L"./deck", [cbDeck](const wchar_t* name, bool isdir) {
if(!isdir && !mywcsncasecmp(wcsrchr(name, '.'), L".ydk", 4)) {
if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".ydk", 4)) {
size_t len = wcslen(name);
wchar_t deckname[256];
wcsncpy(deckname, name, len - 4);
......@@ -889,14 +889,14 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
void Game::RefreshReplay() {
lstReplayList->clear();
FileSystem::TraversalDir(L"./replay", [this](const wchar_t* name, bool isdir) {
if(!isdir && !mywcsncasecmp(wcsrchr(name, '.'), L".yrp", 4) && Replay::CheckReplay(name))
if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".yrp", 4) && Replay::CheckReplay(name))
lstReplayList->addItem(name);
});
}
void Game::RefreshSingleplay() {
lstSinglePlayList->clear();
FileSystem::TraversalDir(L"./single", [this](const wchar_t* name, bool isdir) {
if(!isdir && !mywcsncasecmp(wcsrchr(name, '.'), L".lua", 4))
if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".lua", 4))
lstSinglePlayList->addItem(name);
});
}
......
......@@ -38,7 +38,7 @@ void SoundManager::RefreshBGMList() {
void SoundManager::RefershBGMDir(std::wstring path, int scene) {
std::wstring search = L"./sound/BGM/" + path;
FileSystem::TraversalDir(search.c_str(), [this, &path, scene](const wchar_t* name, bool isdir) {
if(!isdir && (!mywcsncasecmp(wcsrchr(name, '.'), L".mp3", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".ogg", 4))) {
if(!isdir && wcsrchr(name, '.') && (!mywcsncasecmp(wcsrchr(name, '.'), L".mp3", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".ogg", 4))) {
std::wstring filename = path + L"/" + name;
BGMList[BGM_ALL].push_back(filename);
BGMList[scene].push_back(filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment