Преглед изворни кода

dbmi_base: skip manifest files when listing drivers - check permission X_OK

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@50632 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa пре 13 година
родитељ
комит
f177fc87b8
1 измењених фајлова са 9 додато и 8 уклоњено
  1. 9 8
      lib/db/dbmi_base/dbmscap.c

+ 9 - 8
lib/db/dbmi_base/dbmscap.c

@@ -178,18 +178,16 @@ dbDbmscap *db_read_dbmscap(void)
     while ((ent = readdir(dir))) {
 	char *name;
 
-	if ((strcmp(ent->d_name, ".") == 0)
-	    || (strcmp(ent->d_name, "..") == 0))
+	if ((strcmp(ent->d_name, ".") == 0) ||
+	    (strcmp(ent->d_name, "..") == 0))
 	    continue;
 
 #ifdef __MINGW32__
-	/* skip manifest files on Windows */
-	if (G_strstr(ent->d_name, ".manifest"))
-	    continue;
-#endif
-
-	/* Remove '.exe' from name (windows extension) */
+	/* remove '.exe' from name (windows extension) */
 	name = G_str_replace(ent->d_name, ".exe", "");
+#else
+	name = G_store(ent->d_name);
+#endif
 
 #ifdef __MINGW32__
 	dirpath = G_malloc(strlen("\\driver\\db\\")
@@ -199,6 +197,9 @@ dbDbmscap *db_read_dbmscap(void)
 #else
 	G_asprintf(&dirpath, "%s/driver/db/%s", G_gisbase(), ent->d_name);
 #endif
+	if (access(dirpath, X_OK) != 0)
+	    continue;
+	
 	add_entry(&list, name, dirpath, "");
 	G_free(name);
 	G_free(dirpath);