From: Matthew I Date: Sun, 7 Oct 2012 14:03:22 +0000 (-0400) Subject: Ignore directories beginning with a "." when searching for mods X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=6cf87e1d23d829cc0d5c07160e8135ff5887d90d;p=zefram%2Fminetest%2Fminetest_engine.git 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 ".". --- 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(<