[GRASS-SVN] r60278 - grass/trunk/raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 16 14:08:57 PDT 2014


Author: neteler
Date: 2014-05-16 14:08:57 -0700 (Fri, 16 May 2014)
New Revision: 60278

Modified:
   grass/trunk/raster/r.li/r.li.daemon/daemon.c
Log:
r.li.daemon: simplification for r60221

Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c	2014-05-16 21:08:03 UTC (rev 60277)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c	2014-05-16 21:08:57 UTC (rev 60278)
@@ -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