Procházet zdrojové kódy

expand $GISBASE if present in eps filename (merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@37806 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman před 16 roky
rodič
revize
88ec82c7bb
2 změnil soubory, kde provedl 25 přidání a 4 odebrání
  1. 13 2
      ps/ps.map/r_plt.c
  2. 12 2
      ps/ps.map/r_vareas.c

+ 13 - 2
ps/ps.map/r_plt.c

@@ -106,7 +106,7 @@ int read_point(double e, double n)
 
 int read_eps(double e, double n)
 {
-    char buf[1024];
+    char buf[1024], eps_file[GPATH_MAX];
     char *eps;
     double scale, rotate;
     int have_eps;
@@ -140,7 +140,18 @@ int read_eps(double e, double n)
 
 	if (KEY("epsfile")) {
 	    G_chop(data);
-	    eps = G_store(data);
+
+	    /* expand "$GISBASE" if present */
+	    if (strncmp(data, "$GISBASE", 8) != 0)
+		strcpy(eps_file, data);
+	    else {
+		strcpy(eps_file, G_gisbase());
+		data += 8;
+		strcat(eps_file, data);
+	    }
+
+	    eps = G_store(eps_file);
+
 	    /* test if file is accessible */
 	    if ((fp = fopen(eps, "r")) == NULL)
 		error(key, data, "Can't open eps file");

+ 12 - 2
ps/ps.map/r_vareas.c

@@ -34,7 +34,7 @@ static char *help[] = {
 int read_vareas(char *name, char *mapset)
 {
     char fullname[GNAME_MAX + GMAPSET_MAX + 5];
-    char buf[1024];
+    char buf[1024], eps_file[GPATH_MAX];
     char *key, *data;
     double width;
     int itmp, vec;
@@ -172,7 +172,17 @@ int read_vareas(char *name, char *mapset)
 
 	if (KEY("pat") || KEY("pattern")) {
 	    G_chop(data);
-	    vector.layer[vec].pat = G_store(data);
+
+	    /* expand "$GISBASE" if present */
+	    if (strncmp(data, "$GISBASE", 8) != 0)
+		strcpy(eps_file, data);
+	    else {
+		strcpy(eps_file, G_gisbase());
+		data += 8;
+		strcat(eps_file, data);
+	    }
+
+	    vector.layer[vec].pat = G_store(eps_file);
 	    continue;
 	}