From 0541cebfb1a05dc1da3ff29cf391aea41b281e4e Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Wed, 21 Sep 2016 22:48:33 +0300 Subject: [PATCH] Fix unix ignore hidden files --- LuaEngine.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/LuaEngine.cpp b/LuaEngine.cpp index d237bb4..73af2d4 100644 --- a/LuaEngine.cpp +++ b/LuaEngine.cpp @@ -372,14 +372,13 @@ void Eluna::GetScripts(std::string path) std::string fullpath = dir_iter->path().generic_string(); // Check if file is hidden -#ifdef WIN32 +#if PLATFORM == PLATFORM_WINDOWS DWORD dwAttrib = GetFileAttributes(fullpath.c_str()); if (dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_HIDDEN)) continue; -#endif -#ifdef UNIX +#else std::string name = dir_iter->path().filename().generic_string().c_str(); - if (name != ".." || name != "." || name[0] == '.') + if (name[0] == '.') continue; #endif @@ -420,14 +419,13 @@ void Eluna::GetScripts(std::string path) std::string fullpath = path + "/" + directory->d_name; // Check if file is hidden -#ifdef WIN32 +#if PLATFORM == PLATFORM_WINDOWS DWORD dwAttrib = GetFileAttributes(fullpath.c_str()); if (dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_HIDDEN)) continue; -#endif -#ifdef UNIX +#else std::string name = directory->d_name.c_str(); - if (name != ".." || name != "." || name[0] == '.') + if (name[0] == '.') continue; #endif