[GRASS-SVN] r67049 - grass/trunk/raster/r.external
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 10 02:09:04 PST 2015
Author: martinl
Date: 2015-12-10 02:09:04 -0800 (Thu, 10 Dec 2015)
New Revision: 67049
Modified:
grass/trunk/raster/r.external/main.c
Log:
r.external: use CPLGetCurrentDir() instead of getcwd() - mingw/msvc issue
Modified: grass/trunk/raster/r.external/main.c
===================================================================
--- grass/trunk/raster/r.external/main.c 2015-12-10 09:20:48 UTC (rev 67048)
+++ grass/trunk/raster/r.external/main.c 2015-12-10 10:09:04 UTC (rev 67049)
@@ -8,7 +8,7 @@
*
* PURPOSE: Link raster map into GRASS utilizing the GDAL library.
*
- * COPYRIGHT: (C) 2008, 2010-2011 by Glynn Clements and the GRASS Development Team
+ * COPYRIGHT: (C) 2008-2015 by Glynn Clements and the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <math.h>
#include <string.h>
+
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/imagery.h>
@@ -27,6 +28,7 @@
#include <gdal.h>
#include <ogr_srs_api.h>
+#include <cpl_conv.h>
#include "proto.h"
@@ -150,11 +152,14 @@
parm.input->key, parm.source->key);
if (input && !G_is_absolute_path(input)) {
- char path[GPATH_MAX];
- getcwd(path, sizeof(path));
- strcat(path, "/");
- strcat(path, input);
+ char path[GPATH_MAX], *cwd;
+ cwd = CPLGetCurrentDir();
+ if (!cwd)
+ G_fatal_error(_("Unable to get current working directory"));
+
+ G_snprintf(path, GPATH_MAX, "%s%c%s", cwd, HOST_DIRSEP, input);
input = G_store(path);
+ CPLFree(cwd);
}
if (!input)
More information about the grass-commit
mailing list