diff options
author | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-05-26 12:31:39 +0300 |
---|---|---|
committer | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-05-26 12:31:39 +0300 |
commit | bb04cf9032c093e72b53011ea668ee8c613cb901 (patch) | |
tree | a3e817eb9568250b7b20e458b583ae7f243386a2 | |
parent | 043963da36307f91a2f69b8babcafca09e813aa1 (diff) |
Check getcwd() for failure.
Silences a compile warning.
-rw-r--r-- | mgizapp/src/Parameter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mgizapp/src/Parameter.cpp b/mgizapp/src/Parameter.cpp index ff8c400..51ae776 100644 --- a/mgizapp/src/Parameter.cpp +++ b/mgizapp/src/Parameter.cpp @@ -28,6 +28,7 @@ USA. #include <direct.h> #define getcwd _getcwd #endif +#include <stdexcept> #include <strstream> @@ -47,7 +48,9 @@ bool writeParameters(ofstream&of,const ParSet&parset,int level) of << (*i)->getString() << " "; if( absolutePathNames&&(*i)->isFilename()&&s.length()&&s[0]!='/' ) { char path[1024]; - getcwd(path,1024); + if (getcwd(path, 1024) == NULL) + throw std::runtime_error( + "Could not get current working directory."); of << path << '/'; } if( ParameterPathPrefix.length()&&(*i)->isFilename()&&s.length()&&s[0]!='/' ) |