From 744b3be4549719e4c8e7446849a679ad31c17050 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 21 Sep 2013 19:45:11 +0200 Subject: [PATCH] Fixed cFile:IsFolder() and plugin-loading. This should fix loading plugins on Linux. --- source/OSSupport/File.cpp | 3 ++- source/PluginManager.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/OSSupport/File.cpp b/source/OSSupport/File.cpp index 871d9fb94..a4c9a22f4 100644 --- a/source/OSSupport/File.cpp +++ b/source/OSSupport/File.cpp @@ -290,7 +290,8 @@ bool cFile::Rename(const AString & a_OrigFileName, const AString & a_NewFileName bool cFile::IsFolder(const AString & a_Path) { #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 struct stat st; return ((stat(a_Path.c_str(), &st) == 0) && S_ISDIR(st.st_mode)); diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp index e7cac457c..68cb6e40b 100644 --- a/source/PluginManager.cpp +++ b/source/PluginManager.cpp @@ -75,7 +75,7 @@ void cPluginManager::FindPlugins(void) AStringList Files = GetDirectoryContents(PluginsPath.c_str()); for (AStringList::const_iterator itr = Files.begin(); itr != Files.end(); ++itr) { - if (!cFile::IsFolder(*itr)) + if (!cFile::IsFolder(PluginsPath + *itr)) { // We only want folders continue; @@ -84,7 +84,7 @@ void cPluginManager::FindPlugins(void) // Add plugin name/directory to the list if (m_Plugins.find(*itr) == m_Plugins.end()) { - m_Plugins[ *itr ] = NULL; + m_Plugins[*itr] = NULL; } } }