diff options
author | Matthew Newhook <matthew@zeroc.com> | 2009-08-07 11:10:57 +0800 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2009-08-07 11:10:57 +0800 |
commit | e47e08887c823824bfc36f102c065075737394b1 (patch) | |
tree | dcbb175cb6ba3204ac55a06d61d28c488227ab4f /cpp/src/IceGrid/IceGridNode.cpp | |
parent | Revert "4171 - Global namespace pollution" (diff) | |
download | ice-e47e08887c823824bfc36f102c065075737394b1.tar.bz2 ice-e47e08887c823824bfc36f102c065075737394b1.tar.xz ice-e47e08887c823824bfc36f102c065075737394b1.zip |
Revert "Changes for bug 3962 and 4714"
This reverts commit d38ad95e45c0083d602a43e6d77e6c1599f324fe.
Diffstat (limited to 'cpp/src/IceGrid/IceGridNode.cpp')
-rw-r--r-- | cpp/src/IceGrid/IceGridNode.cpp | 39 |
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); } |