summaryrefslogtreecommitdiff
path: root/src/mods.cpp
diff options
context:
space:
mode:
authorMatthew I <matttpt@gmail.com>2012-10-07 10:03:22 -0400
committerPerttu Ahola <celeron55@gmail.com>2012-11-30 21:41:50 +0200
commit6cf87e1d23d829cc0d5c07160e8135ff5887d90d (patch)
tree1a1b6a0787c5e038d8bf2cd8a9718e2c7896c7a8 /src/mods.cpp
parent8a93581c8ab457819a258286aca4ef4359d80877 (diff)
downloadminetest-6cf87e1d23d829cc0d5c07160e8135ff5887d90d.tar.gz
minetest-6cf87e1d23d829cc0d5c07160e8135ff5887d90d.tar.bz2
minetest-6cf87e1d23d829cc0d5c07160e8135ff5887d90d.zip
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 ".".
Diffstat (limited to 'src/mods.cpp')
-rw-r--r--src/mods.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mods.cpp b/src/mods.cpp
index c2bb907c2..08e8e276f 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(<<indentation<<"collectMods: "<<modname<<" at \""<<modpath<<"\""<<std::endl);
// Handle modpacks (defined by containing modpack.txt)