diff options
author | Jose <jose@zeroc.com> | 2009-11-10 05:30:26 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2009-11-10 05:30:26 +0100 |
commit | 4247c9e2c2612394a5f4d63a65ba538f975906d4 (patch) | |
tree | 96d3308681d9b0684ce5dd763f5a5d415eaf09d7 /cpp/test/IceGrid/deployer/Server.cpp | |
parent | Win32 64 bits compilation error (diff) | |
download | ice-4247c9e2c2612394a5f4d63a65ba538f975906d4.tar.bz2 ice-4247c9e2c2612394a5f4d63a65ba538f975906d4.tar.xz ice-4247c9e2c2612394a5f4d63a65ba538f975906d4.zip |
Fixed 3962 - Berkeley DB, problems with unicode paths.
Diffstat (limited to 'cpp/test/IceGrid/deployer/Server.cpp')
-rw-r--r-- | cpp/test/IceGrid/deployer/Server.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/cpp/test/IceGrid/deployer/Server.cpp b/cpp/test/IceGrid/deployer/Server.cpp index 3f731848996..48d55d5bd77 100644 --- a/cpp/test/IceGrid/deployer/Server.cpp +++ b/cpp/test/IceGrid/deployer/Server.cpp @@ -11,6 +11,7 @@ #include <Ice/Ice.h> #include <TestI.h> #include <TestCommon.h> +#include <fstream> using namespace std; @@ -31,7 +32,6 @@ Server::run(int argc, char* argv[]) Ice::stringSeqToArgs(args, argc, argv); string name = properties->getProperty("Ice.ProgramName"); - Ice::ObjectAdapterPtr adapter; if(!properties->getProperty("ReplicatedAdapter").empty()) @@ -43,7 +43,6 @@ Server::run(int argc, char* argv[]) adapter = communicator()->createObjectAdapter("Server"); Ice::ObjectPtr object = new TestI(properties); adapter->add(object, communicator()->stringToIdentity(name)); - shutdownOnInterrupt(); try { @@ -66,6 +65,48 @@ main(int argc, char* argv[]) char* value = getenv("MY_ENV_VARIABLE"); test(value != 0 && string(value) == "12"); + ifstream in("envs"); + if(!in) + { + test(false); + } + string unicodeVar; + string varname1; + string varname2; + if(!getline(in, unicodeVar) || !getline(in, varname1) || !getline(in, varname2)) + { + test(false); + } + +#if defined(_WIN32) + + // + // COMPILERFIX: Unicode environments don't work well with VC6 applications, + // for some reasons, the wstring returned by _wgetenv are incorrect. + // +#if (!defined(_MSC_VER) || _MSC_VER >= 1300) + wchar_t* value2 = _wgetenv(L"MY_ENV_UNICODE_VARIABLE"); + test(value2 != 0 && wstring(value2) == IceUtil::stringToWstring(unicodeVar)); + + wchar_t* value3 = _wgetenv(IceUtil::stringToWstring(varname1).c_str()); + test(value3 != 0 && wstring(value3) == L"2"); + + // Environment variables are case insensitive on Windows. + wchar_t* value4 = _wgetenv(IceUtil::stringToWstring(varname1).c_str()); + test(value4 != 0 && wstring(value4) == L"2"); +#endif + +#else + char* value2 = getenv("MY_ENV_UNICODE_VARIABLE"); + test(value2 !=0 && string(value2) == unicodeVar); + + char* value3 = getenv(varname1.c_str()); + test(value3 != 0 && string(value3) == "1"); + + char* value4 = getenv(varname2.c_str()); + test(value4 != 0 && string(value4) == "2"); +#endif + Server app; int rc = app.main(argc, argv); return rc; |