[GRASS-SVN] r57951 - grass/trunk/raster/r.in.lidar

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 6 23:27:14 PDT 2013


Author: mmetz
Date: 2013-10-06 23:27:14 -0700 (Sun, 06 Oct 2013)
New Revision: 57951

Modified:
   grass/trunk/raster/r.in.lidar/main.c
Log:
r.in.lidar: test if file exists

Modified: grass/trunk/raster/r.in.lidar/main.c
===================================================================
--- grass/trunk/raster/r.in.lidar/main.c	2013-10-06 23:31:36 UTC (rev 57950)
+++ grass/trunk/raster/r.in.lidar/main.c	2013-10-07 06:27:14 UTC (rev 57951)
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <math.h>
 #include <sys/types.h>
 #include <grass/gis.h>
@@ -273,8 +274,11 @@
 	scan_flag->answer = 1; /* pointer not int, so set = shell_style->answer ? */
     }
 
+    /* Don't crash on cmd line if file not found */
+    if (access(infile, F_OK) != 0) {
+	G_fatal_error(_("Input file <%s> does not exist"), infile);
+    }
     /* Open LAS file*/
-    /* TODO: don't crash on cmd line if file not found. This test still fails */
     LAS_reader = LASReader_Create(infile);
     if (LAS_reader == NULL) {
 	G_fatal_error(_("Unable to open file <%s>"), infile);



More information about the grass-commit mailing list