summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/IceGridNode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/IceGridNode.cpp')
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index e5f7304bd68..a78d45531a7 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -10,7 +10,6 @@
#include <IceUtil/UUID.h>
#include <IceUtil/Timer.h>
#include <IceUtil/StringUtil.h>
-#include <IceUtil/FileUtil.h>
#include <Ice/Ice.h>
#include <Ice/Locator.h>
#include <Ice/Service.h>
@@ -34,7 +33,14 @@
#ifdef _WIN32
# include <direct.h>
# include <sys/types.h>
+# include <sys/stat.h>
# include <winsock2.h>
+# ifdef _MSC_VER
+# define S_ISDIR(mode) ((mode) & _S_IFDIR)
+# define S_ISREG(mode) ((mode) & _S_IFREG)
+# endif
+#else
+# include <sys/stat.h>
#endif
using namespace std;
@@ -363,7 +369,9 @@ NodeService::startImpl(int argc, char* argv[])
}
else
{
- if(!IceUtilInternal::directoryExists(dataPath))
+#ifdef _WIN32
+ struct _stat filestat;
+ if(::_stat(dataPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
{
ostringstream os;
FileException ex(__FILE__, __LINE__);
@@ -372,7 +380,20 @@ NodeService::startImpl(int argc, char* argv[])
os << ex;
error("property `IceGrid.Node.Data' is set to an invalid path:\n" + os.str());
return false;
- }
+ }
+#else
+ struct stat filestat;
+ if(::stat(dataPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
+ {
+ ostringstream os;
+ FileException ex(__FILE__, __LINE__);
+ ex.path = dataPath;
+ ex.error = getSystemErrno();
+ os << ex;
+ error("property `IceGrid.Node.Data' is set to an invalid path:\n" + os.str());
+ return false;
+ }
+#endif
//
// Creates subdirectories.
@@ -811,19 +832,9 @@ NodeService::usage(const string& appName)
print("Usage: " + appName + " [options]\n" + options);
}
-#ifdef _WIN32
-
-int
-wmain(int argc, wchar_t* argv[])
-
-#else
-
int
main(int argc, char* argv[])
-
-#endif
{
NodeService svc;
- int rc = svc.main(argc, argv);
- return rc;
+ return svc.main(argc, argv);
}