Random fixes and cleanups

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5297 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-04-08 16:59:35 +00:00
parent b452bf7051
commit f727139ebf
22 changed files with 555 additions and 573 deletions

View File

@ -74,17 +74,13 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
size_t dot_pos = _searchString.rfind(".");
if (dot_pos == std::string::npos)
{
return;
}
std::string ext = _searchString.substr(dot_pos);
DIR* dir = opendir(_strPath.c_str());
if (!dir)
{
return;
}
dirent* dp;
@ -93,19 +89,17 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
dp = readdir(dir);
if (!dp)
{
break;
}
std::string s(dp->d_name);
if ( (s.size() > ext.size()) && (!strcasecmp(s.substr(s.size() - ext.size()).c_str(), ext.c_str())) )
{
std::string full_name;
if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR)
full_name = _strPath + s;
else
full_name = _strPath + DIR_SEP + s;
std::string full_name;
if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR)
full_name = _strPath + s;
else
full_name = _strPath + DIR_SEP + s;
m_FileNames.push_back(full_name);
}
@ -118,5 +112,5 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
const CFileSearch::XStringVector& CFileSearch::GetFileNames() const
{
return(m_FileNames);
return m_FileNames;
}

View File

@ -23,21 +23,17 @@
class CFileSearch
{
public:
public:
typedef std::vector<std::string>XStringVector;
typedef std::vector<std::string>XStringVector;
CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories);
const XStringVector& GetFileNames() const;
CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories);
private:
const XStringVector& GetFileNames() const;
void FindFiles(const std::string& _searchString, const std::string& _strPath);
private:
void FindFiles(const std::string& _searchString, const std::string& _strPath);
XStringVector m_FileNames;
XStringVector m_FileNames;
};
#endif // _FILESEARCH_H_

View File

@ -123,7 +123,7 @@ bool Delete(const char *filename)
}
#else
if (unlink(filename) == -1) {
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s",
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s",
filename, GetLastErrorMsg());
return false;
}
@ -594,7 +594,6 @@ std::string GetPluginsDirectory()
INFO_LOG(COMMON, "GetPluginsDirectory: Setting to %s:", pluginsDir.c_str());
return pluginsDir;
}
// Returns the path to where the sys file are