Fixed cFile:IsFolder() and plugin-loading.
This should fix loading plugins on Linux.
This commit is contained in:
parent
6b61df3b73
commit
744b3be454
@ -290,7 +290,8 @@ bool cFile::Rename(const AString & a_OrigFileName, const AString & a_NewFileName
|
|||||||
bool cFile::IsFolder(const AString & a_Path)
|
bool cFile::IsFolder(const AString & a_Path)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return ((GetFileAttributes(a_Path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) != 0);
|
DWORD FileAttrib = GetFileAttributes(a_Path.c_str());
|
||||||
|
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & FILE_ATTRIBUTE_DIRECTORY) != 0));
|
||||||
#else
|
#else
|
||||||
struct stat st;
|
struct stat st;
|
||||||
return ((stat(a_Path.c_str(), &st) == 0) && S_ISDIR(st.st_mode));
|
return ((stat(a_Path.c_str(), &st) == 0) && S_ISDIR(st.st_mode));
|
||||||
|
@ -75,7 +75,7 @@ void cPluginManager::FindPlugins(void)
|
|||||||
AStringList Files = GetDirectoryContents(PluginsPath.c_str());
|
AStringList Files = GetDirectoryContents(PluginsPath.c_str());
|
||||||
for (AStringList::const_iterator itr = Files.begin(); itr != Files.end(); ++itr)
|
for (AStringList::const_iterator itr = Files.begin(); itr != Files.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (!cFile::IsFolder(*itr))
|
if (!cFile::IsFolder(PluginsPath + *itr))
|
||||||
{
|
{
|
||||||
// We only want folders
|
// We only want folders
|
||||||
continue;
|
continue;
|
||||||
@ -84,7 +84,7 @@ void cPluginManager::FindPlugins(void)
|
|||||||
// Add plugin name/directory to the list
|
// Add plugin name/directory to the list
|
||||||
if (m_Plugins.find(*itr) == m_Plugins.end())
|
if (m_Plugins.find(*itr) == m_Plugins.end())
|
||||||
{
|
{
|
||||||
m_Plugins[ *itr ] = NULL;
|
m_Plugins[*itr] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user