[GRASS-SVN] r57952 - grass/trunk/vector/v.in.lidar

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


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

Modified:
   grass/trunk/vector/v.in.lidar/main.c
Log:
v.in.lidar: test if file exists

Modified: grass/trunk/vector/v.in.lidar/main.c
===================================================================
--- grass/trunk/vector/v.in.lidar/main.c	2013-10-07 06:27:14 UTC (rev 57951)
+++ grass/trunk/vector/v.in.lidar/main.c	2013-10-07 06:27:42 UTC (rev 57952)
@@ -21,6 +21,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <grass/gis.h>
 #include <grass/dbmi.h>
 #include <grass/vector.h>
@@ -228,6 +229,10 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
+    /* Don't crash on cmd line if file not found */
+    if (access(in_opt->answer, F_OK) != 0) {
+	G_fatal_error(_("Input file <%s> does not exist"), infile);
+    }
     /* Open LAS file*/
     LAS_reader = LASReader_Create(in_opt->answer);
     LAS_header = LASReader_GetHeader(LAS_reader);



More information about the grass-commit mailing list