فهرست منبع

strip away config file path if it is present and if it matches the config dir (merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38779 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 16 سال پیش
والد
کامیت
fb70deba37
1فایلهای تغییر یافته به همراه10 افزوده شده و 5 حذف شده
  1. 10 5
      raster/r.li/r.li.daemon/daemon.c

+ 10 - 5
raster/r.li/r.li.daemon/daemon.c

@@ -58,6 +58,7 @@ int calculateIndex(char *file, int f(int, char **, area_des, double *),
     g = (g_areas) G_malloc(sizeof(struct generatore));
     l = (list) G_malloc(sizeof(struct lista));
     mypid = getpid();
+
     /* create report pipe */
     reportChannelName = G_tempfile();
     if (mkfifo(reportChannelName, 0644) == -1)
@@ -97,16 +98,24 @@ int calculateIndex(char *file, int f(int, char **, area_des, double *),
     /*open reportChannel */
     receiveChannel = open(reportChannelName, O_RDONLY, 0755);
 
+
     /*########################################################      
        -----------------create area queue----------------------
        ######################################################### */
 
+    /* strip off leading path if present */
+    char testpath[GPATH_MAX];
+    sprintf(testpath, "%s%s", G_home(), "/.grass7/r.li/");
+    if(strncmp(file, testpath, strlen(testpath)) == 0)
+	file += strlen(testpath);
+
     /* TODO: check if this path is portable */
 /* TODO: use G_rc_path() */
     sprintf(pathSetup, "%s/.grass7/r.li/%s", G_home(), file);
     G_debug(1, "r.li.daemon pathSetup: [%s]", pathSetup);
     parsed = parseSetup(pathSetup, l, g, raster);
 
+
     /*########################################################
        -----------------open output file ---------------------
        ####################################################### */
@@ -319,10 +328,6 @@ int parseSetup(char *path, list l, g_areas g, char *raster)
     int sf_x, sf_y, sf_rl, sf_cl;
     int size;
 
-    /* TODO: if present, strip away G_home()/.r.li/history/ path from string */
-    /*  ? if(strncmp(G_rc_path(), path, strlen(G_rc_path()) ) == 0)
-	?     path += strlen(G_rc_path());
-	? */
     if (stat(path, &s) != 0)
 	G_fatal_error(_("Cannot find configuration file <%s>"), path);
 
@@ -376,7 +381,6 @@ int parseSetup(char *path, list l, g_areas g, char *raster)
 	    rel_sa_cl = atof(strtok(NULL, "\n"));
 
 	    if (rel_sa_x == -1.0 && rel_sa_y == -1.0) {
-
 		/* runtime disposition */
 
 		int sa_rl, sa_cl;
@@ -392,6 +396,7 @@ int parseSetup(char *path, list l, g_areas g, char *raster)
 		g->sf_y = sf_y;
 		g->x = sf_x;
 		g->y = sf_y;
+
 		return disposeAreas(l, g, strtok(NULL, "\n"));
 	    }
 	    else {