[GRASS-SVN] r61337 - in grass/branches/releasebranch_7_0: . raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 22 13:51:08 PDT 2014


Author: neteler
Date: 2014-07-22 13:51:08 -0700 (Tue, 22 Jul 2014)
New Revision: 61337

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/raster/r.li/r.li.daemon/daemon.c
Log:
r.li.daemon: simplification of r60221 (trunk, r60278)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:60219,60610,60807,60936-60937,61275,61288,61290,61292,61294,61301
   + /grass/trunk:60219,60278,60610,60807,60936-60937,61275,61288,61290,61292,61294,61301

Modified: grass/branches/releasebranch_7_0/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.li/r.li.daemon/daemon.c	2014-07-22 20:07:54 UTC (rev 61336)
+++ grass/branches/releasebranch_7_0/raster/r.li/r.li.daemon/daemon.c	2014-07-22 20:51:08 UTC (rev 61337)
@@ -70,15 +70,19 @@
        ######################################################### */
 
     /* strip off leading path if present */
+    char rlipath[GPATH_MAX];
     char testpath[GPATH_MAX];
 
+	/* conf files go into ~/.grass7/r.li/ */
+    sprintf(rlipath, "%s%c%s%c", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP);
+
     sprintf(testpath, "%s%c%s%c", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP);
     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%c%s%c%s", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP, file);
+    sprintf(pathSetup, "%s%s", rlipath, file);
     G_debug(1, "r.li.daemon pathSetup: [%s]", pathSetup);
     parsed = parseSetup(pathSetup, l, g, raster);
 
@@ -107,18 +111,17 @@
 	    G_fatal_error(_("Cannot create %s directory"), out);
 
 	/* check if ~/.grass7/r.li/ exists */
-	sprintf(out, "%s%c%s%c", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP);
+	sprintf(out, "%s", rlipath);
 	doneDir = G_mkdir(out);
 	if (doneDir == -1 && errno != EEXIST)
 	    G_fatal_error(_("Cannot create %s directory"), out);
 
 	/* check if ~/.grass7/r.li/output exists */
-	sprintf(out, "%s%c%s%c%s", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP, "output");
+	sprintf(out, "%s%s", rlipath, "output");
 	doneDir = G_mkdir(out);
 	if (doneDir == -1 && errno != EEXIST)
 	    G_fatal_error(_("Cannot create %s directory"), out);
-	sprintf(out, "%s%c%s%c%s%c%s",
-                G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP, "output", HOST_DIRSEP, output);
+	sprintf(out, "%s%s%c%s", rlipath, "output", HOST_DIRSEP, output);
 	res = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0644);
     }
     i = 0;



More information about the grass-commit mailing list