From 6cf87e1d23d829cc0d5c07160e8135ff5887d90d Mon Sep 17 00:00:00 2001 From: Matthew I Date: Sun, 7 Oct 2012 10:03:22 -0400 Subject: [PATCH] Ignore directories beginning with a "." when searching for mods This is not a problem on POSIX systems (these directories are ignored by the POSIX implementation of fs::GetDirListing() in filesys.cpp), but these directories still are reported on Windows systems. This becomes a problem when mod authors use version control systems that create directories like ".git" or ".svn" and collectMods() picks up on them. It has also been suggested that ignoring such directories would allow for the easily disabling mods by inserting a "." in front of their name. This quick fix simply makes collectMods() ignore directories beginning with a ".". --- src/mods.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mods.cpp b/src/mods.cpp index c2bb907c..08e8e276 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -39,6 +39,10 @@ static void collectMods(const std::string &modspath, if(!dirlist[j].dir) continue; std::string modname = dirlist[j].name; + // Ignore all directories beginning with a ".", especially + // VCS directories like ".git" or ".svn" + if(modname[0] == '.') + continue; std::string modpath = modspath + DIR_DELIM + modname; TRACESTREAM(<