summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-04-27 19:26:53 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-04-27 19:26:53 (GMT)
commit6c6eebac202e5988bfa2381cfe1d0bdafe40f01c (patch)
tree61ad38248443c9eec2de19c67b634a3602710346 /Source/kwsys/SystemTools.cxx
parent2ae84e5ba686ef6fdf3604e24aea640850a7cf53 (diff)
downloadCMake-6c6eebac202e5988bfa2381cfe1d0bdafe40f01c.zip
CMake-6c6eebac202e5988bfa2381cfe1d0bdafe40f01c.tar.gz
CMake-6c6eebac202e5988bfa2381cfe1d0bdafe40f01c.tar.bz2
ENH: handle running from a directory that has been deleted
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index e70d3fc..6496f17 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -118,7 +118,12 @@ inline int Rmdir(const char* dir)
}
inline const char* Getcwd(char* buf, unsigned int len)
{
- return _getcwd(buf, len);
+ const char* ret _getcwd(buf, len);
+ if(!ret)
+ {
+ fprintf(stderr, "No current working directory.\n");
+ abort();
+ }
}
inline int Chdir(const char* dir)
{
@@ -152,8 +157,15 @@ inline int Rmdir(const char* dir)
}
inline const char* Getcwd(char* buf, unsigned int len)
{
- return getcwd(buf, len);
+ const char* ret = getcwd(buf, len);
+ if(!ret)
+ {
+ fprintf(stderr, "No current working directory\n");
+ abort();
+ }
+ return ret;
}
+
inline int Chdir(const char* dir)
{
return chdir(dir);