|
@@ -187,11 +187,26 @@ char **G_available_mapsets(void)
|
|
|
*/
|
|
|
void G_add_mapset_to_search_path(const char *mapset)
|
|
|
{
|
|
|
- int i;
|
|
|
+ if (!G_is_mapset_in_search_path(mapset))
|
|
|
+ new_mapset(mapset);
|
|
|
+}
|
|
|
+
|
|
|
+/*!
|
|
|
+ \brief Check if given mapset is in search path
|
|
|
|
|
|
- for (i = 0; i < st->path.count; i++)
|
|
|
+ \param mapset mapset name
|
|
|
+
|
|
|
+ \return 1 mapset found in search path
|
|
|
+ \return 0 mapset not found
|
|
|
+*/
|
|
|
+int G_is_mapset_in_search_path(const char *mapset)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+
|
|
|
+ for (i = 0; i < st->path.count; i++) {
|
|
|
if (strcmp(st->path.names[i], mapset) == 0)
|
|
|
- return;
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
|
|
|
- new_mapset(mapset);
|
|
|
+ return 0;
|
|
|
}
|