|
@@ -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 @@ int main(int argc, char *argv[])
|
|
|
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)
|