]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/pluginentities.cpp
set eol-style
[xonotic/netradiant.git] / radiant / pluginentities.cpp
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \r
7 GtkRadiant is free software; you can redistribute it and/or modify\r
8 it under the terms of the GNU General Public License as published by\r
9 the Free Software Foundation; either version 2 of the License, or\r
10 (at your option) any later version.\r
11 \r
12 GtkRadiant is distributed in the hope that it will be useful,\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 GNU General Public License for more details.\r
16 \r
17 You should have received a copy of the GNU General Public License\r
18 along with GtkRadiant; if not, write to the Free Software\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
20 */\r
21 \r
22 //-----------------------------------------------------------------------------\r
23 //\r
24 // DESCRIPTION:\r
25 // implementation of IPluginEntities specific interface\r
26 // \r
27 \r
28 #ifdef USEPLUGINENTITIES\r
29 \r
30 #include "stdafx.h"\r
31 #if defined (__linux__) || defined (__APPLE__)\r
32 #include <dirent.h>\r
33 #endif\r
34 //#include "qe3.h"\r
35 \r
36 int QERApp_EClassScanDir (char *path, void* hPlug)\r
37 {\r
38   char          temp[NAME_MAX];\r
39   char          filebase[NAME_MAX];\r
40   char          filename[NAME_MAX];\r
41   char          *s;\r
42   eclass_t      *e;\r
43   DIR           *dir;\r
44   struct dirent *dirlist;\r
45 \r
46   QE_ConvertDOSToUnixName( temp, path );\r
47   strcpy (filebase, path);\r
48   s = filebase + strlen(filebase)-1;\r
49   while (*s != '\\' && *s != '/' && s!=filebase)\r
50     s--;\r
51   *s = 0;\r
52 \r
53   dir = opendir (path);\r
54   if (dir != NULL)\r
55   {\r
56     while ((dirlist = readdir (dir)) != NULL)\r
57     {                   \r
58       sprintf (filename, "%s/%s", filebase, dirlist->d_name);\r
59       Eclass_ScanFile (filename);\r
60 \r
61       if (eclass_found)\r
62       {\r
63         e = eclass_e;\r
64         e->modelpath = strdup(dirlist->d_name);\r
65         e->nShowFlags |= ECLASS_PLUGINENTITY;\r
66         e->hPlug = hPlug;\r
67       }\r
68     }\r
69     closedir (dir);\r
70   }\r
71   return 0;\r
72 }\r
73 \r
74 #endif // USEPLUGINENTITIES\r