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 ".".
This commit is contained in:
Matthew I 2012-10-07 10:03:22 -04:00 committed by Perttu Ahola
parent 8a93581c8a
commit 6cf87e1d23
1 changed files with 4 additions and 0 deletions

View File

@ -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(<<indentation<<"collectMods: "<<modname<<" at \""<<modpath<<"\""<<std::endl);
// Handle modpacks (defined by containing modpack.txt)