+ int j;
+
+ g_numForbiddenDirs = 0;
+ StringTokeniser st(GlobalRadiant().getGameDescriptionKeyValue("forbidden_paths"), " ");
+ for(j = 0; j < VFS_MAXDIRS; ++j)
+ {
+ const char *t = st.getToken();
+ if(string_empty(t))
+ break;
+ strncpy(g_strForbiddenDirs[g_numForbiddenDirs], t, PATH_MAX);
+ g_strForbiddenDirs[g_numForbiddenDirs][PATH_MAX] = '\0';
+ ++g_numForbiddenDirs;
+ }
+
+ for(j = 0; j < g_numForbiddenDirs; ++j)
+ {
+ char* dbuf = g_strdup(directory);
+ if(*dbuf && dbuf[strlen(dbuf)-1] == '/')
+ dbuf[strlen(dbuf)-1] = 0;
+ const char *p = strrchr(dbuf, '/');
+ p = (p ? (p+1) : dbuf);
+ if(matchpattern(p, g_strForbiddenDirs[j], TRUE))
+ {
+ g_free(dbuf);
+ break;
+ }
+ g_free(dbuf);
+ }
+ if(j < g_numForbiddenDirs)
+ {
+ printf("Directory %s matched by forbidden dirs, removed\n", directory);
+ return;
+ }
+