summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rwxr-xr-xcpp/src/iceserviceinstall/Install.cpp19
-rwxr-xr-xcpp/src/iceserviceinstall/ServiceInstaller.cpp28
2 files changed, 40 insertions, 7 deletions
diff --git a/cpp/src/iceserviceinstall/Install.cpp b/cpp/src/iceserviceinstall/Install.cpp
index 124961b9e83..c1e11015280 100755
--- a/cpp/src/iceserviceinstall/Install.cpp
+++ b/cpp/src/iceserviceinstall/Install.cpp
@@ -23,6 +23,7 @@ public:
bool pauseEnabled() const;
bool debug() const;
+ bool pause() const;
private:
@@ -30,6 +31,7 @@ private:
bool _debug;
bool _pauseEnabled;
+ bool _pause;
};
int
@@ -38,7 +40,7 @@ main(int argc, char* argv[])
Install app;
int status = app.main(argc, argv);
- if(app.pauseEnabled() && (app.debug() || status != 0))
+ if(app.pauseEnabled() && (app.pause() || app.debug() || status != 0))
{
system("pause");
}
@@ -74,19 +76,21 @@ Install::run(int argc, char* argv[])
return EXIT_FAILURE;
}
+ _pauseEnabled = !opts.isSet("nopause");
+
if(opts.isSet("help"))
{
usage();
+ _pause = true;
return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
cout << ICE_STRING_VERSION << endl;
+ _pause = true;
return EXIT_SUCCESS;
}
- _pauseEnabled = !opts.isSet("nopause");
-
if(commands.size() != 2)
{
usage();
@@ -151,7 +155,8 @@ Install::run(int argc, char* argv[])
Install::Install() :
_pauseEnabled(true),
- _debug(false)
+ _debug(false),
+ _pause(false)
{
}
@@ -167,6 +172,12 @@ Install::debug() const
return _debug;
}
+bool
+Install::pause() const
+{
+ return _pause;
+}
+
void
Install::usage() const
{
diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.cpp b/cpp/src/iceserviceinstall/ServiceInstaller.cpp
index 66c770998b5..fc055fe1efc 100755
--- a/cpp/src/iceserviceinstall/ServiceInstaller.cpp
+++ b/cpp/src/iceserviceinstall/ServiceInstaller.cpp
@@ -30,10 +30,28 @@
using namespace std;
using namespace Ice;
+//
+// Replace / by \
+//
+inline string
+fixDirSeparator(const string& path)
+{
+ string result = path;
+ size_t pos = 0;
+ while((pos = result.find('/', pos)) != string::npos)
+ {
+ result[pos] = '\\';
+ pos++;
+ }
+
+ return result;
+}
+
+
IceServiceInstaller::IceServiceInstaller(int serviceType, const string& configFile,
const CommunicatorPtr& communicator) :
_serviceType(serviceType),
- _configFile(configFile),
+ _configFile(fixDirSeparator(configFile)),
_communicator(communicator),
_serviceProperties(createProperties()),
_sid(0),
@@ -137,6 +155,10 @@ IceServiceInstaller::install(const PropertiesPtr& properties)
imagePath.replace(imagePath.rfind('\\'), string::npos, "\\"
+ serviceTypeToLowerString(_serviceType) + ".exe");
}
+ else
+ {
+ imagePath = fixDirSeparator(imagePath);
+ }
if(!fileExists(imagePath))
{
throw imagePath + ": not found";
@@ -151,7 +173,7 @@ IceServiceInstaller::install(const PropertiesPtr& properties)
throw "The IceGrid registry service can't depend on itself";
}
- string registryDataDir = _serviceProperties->getProperty("IceGrid.Registry.Data");
+ string registryDataDir = fixDirSeparator(_serviceProperties->getProperty("IceGrid.Registry.Data"));
if(registryDataDir == "")
{
throw "IceGrid.Registry.Data must be set in " + _configFile;
@@ -163,7 +185,7 @@ IceServiceInstaller::install(const PropertiesPtr& properties)
}
else if(_serviceType == icegridnode)
{
- string nodeDataDir = _serviceProperties->getProperty("IceGrid.Node.Data");
+ string nodeDataDir = fixDirSeparator(_serviceProperties->getProperty("IceGrid.Node.Data"));
if(nodeDataDir == "")
{
throw "IceGrid.Node.Data must be set in " + _configFile;